I am using the following to remove the trailing slash:

 <VirtualHost *:80>


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


</VirtualHost>

However, whenever I access my homepage (e.g. http://www.example.com/) I get a redirect loop

有帮助吗?

解决方案

 <VirtualHost *:80>


RewriteEngine On
RewriteRule ^(.+)/$ $1 [R=301,L]


</VirtualHost>

Use + instead of *

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top