Question

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

Was it helpful?

Solution

 <VirtualHost *:80>


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


</VirtualHost>

Use + instead of *

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top