Quantcast
Viewing all articles
Browse latest Browse all 11

Remove trailing slash with Apache

With Apache and mod_rewrite, to avoid urls like /page1 and /page1/ to respond with the same content, you can use mod_rewrite with the following syntax:

# Remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 11

Trending Articles