Answer the question
In order to leave comments, you need to log in
How to prevent a bunch of slashes at the end of the address bar?
Friends, how to use .htaccess to redirect a user from such an address site.com/////////// to such site.com/ (or without a slash at the end). Should be relevant for site.com/folder///////////
Thank you!
Answer the question
In order to leave comments, you need to log in
Bullshit business:
####remove many slashes####
RewriteCond %{THE_REQUEST} \ (.*)//+(.*)\ [NC]
RewriteRule (.*) %1/%2 [R=301,L]
####remove trailing ;,.()[] ####
RewriteCond %{REQUEST_URI} ^(.*[;,.\(\)\[\]]+)$
RewriteRule ^(.*[^;,.\(\)\[\]]+) /$1 [R=301,L]
####add trailing slash####
RewriteCond %{REQUEST_URI} !^(.*\/[^\/]+\.[^\/]+)$
RewriteRule ^(.*)([^/])$ /$1$2/ [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question