1
我正在使用.htaccess規則。.htaccess文件 - 刪除所有URL的尾部斜槓
我想刪除所有網址的尾部斜槓。
For ex:-
http://www.test.com/admin Working fine
But
http://www.test.com/admin/ Gives me error.
如果我跑URL像http://www.test.com/admin/dashboard/ 那麼它auomatically重定向到http://www.test.com/admin/dashboard
我在htaccess文件把下面的代碼。
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]
但它的重定向是這樣的。
http://www.test.com/var/www/html/test/public/admin
似乎複製。請檢查http://stackoverflow.com/questions/21417263/htaccess-add-remove-trailing-slash-from-url – sAcH
感謝您的快速響應..它的工作作爲魅力 –