2016-07-23 35 views
0

我的DocumentRoot是無功/網絡/公共mod_rewrite的一段時間增加的DocumentRoot路徑URL

我有以下.htaccess文件(內無功/網絡/公共):

SetEnv APPLICATION_ENV development 
RewriteEngine On 

RewriteRule ^(.*)/$ $1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 

RewriteRule ^.*$ index.php [NC,L] 

當我輸入例如http://localhost:8080/en/schedule/它工作正常 - 重定向到URL沒有斜線(http://localhost:8080/en/schedule

但有些情況下,它不能正常工作:

http://localhost:8080/en/news/重定向到http://localhost:8080/var/www/public/en/news

+0

確實/ EN /新聞存在嗎? – olegsv

+0

[Htaccess:添加/刪除URL的尾部斜槓]的可能重複(http://stackoverflow.com/questions/21417263/htaccess-add-remove-trailing-slash-from-url) – olegsv

+0

是的,存在。我已經解決了它(請參閱我的答案),謝謝。 – komik966

回答

1

的不同環節不同的行爲是由Web瀏覽器緩存引起的。

新的.htaccess:

SetEnv APPLICATION_ENV development 
RewriteEngine On 

RewriteCond %{REQUEST_URI} ^(.*)/$ 
RewriteRule ^(.*)/$ %1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 

RewriteRule ^.*$ index.php [NC,L]