-1
我已經試圖把404刷新時角路線
<base href="/index.html"> and/or <base href="/">
我已經配置我.htacess這樣的:
Options +FollowSymLinks
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index1.html [L]
</ifModule>
這:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# If the requested pattern is file and file doesn't exist, send 404
RewriteCond %{REQUEST_URI} ^(\/[a-z_\-\s0-9\.]+)+\.[a-zA-Z]{2,4}$
RewriteRule^- [L,R=404]
RewriteRule ^(.*) index.html [NC,L]
而且我也知道我的mod_rewrite已啓用:
apache2ctl -M^C
> rewrite_module (shared)
這適用於加載家庭,並點擊所有鏈接...但是,如果我打開/通過點擊登錄,它會正常打開。但是如果我只是重新加載它,或者輸入相同地址的url地址,它將不起作用,它會給我404。任何想法?
Ps。我正在使用ui-route $locationProvider.html5Mode(true);
所以路由沒有#,路由IS /登錄,並且這可以工作....除了刷新之外的所有場景
沒有一個重寫規則的主人,但你有你需要添加一個規則的問題將接受'/ login'和重定向/重寫'/index.html#登錄「或類似的根據你的'角路由器'設置..當你執行頁面刷新請求命中服務器,返回404登錄'不存在作爲服務器資源..這只是一個路線在你的角度的應用程序 – Searching
但我不能爲每條路線做這些......這就是爲什麼我使用這個:'RewriteRule ^(。*)index.html [NC,L]'一切(例如登錄)應重定向到索引....我使用ui-route htmlMode true,所以沒有「#」的url – Gabrielle
你有沒有試過ui-serf –