Reputation: 61
I have following code below ;
RewriteRule ^((?!fr|en).*)\/(\?.*)?$ /$1 [L,R=301]
and while i am trying;
example.com/fr/
example.com/en/
turns to
example.com/fr/
example.com/en/
which is what i want to however once i try to;
example.com/frabcdefg/
example.com/enabcedefg/
then it doesn't remove the trailing slash that because it begins with en or fr but it should be.
Is there any way to do so ?
edit: what i want to achieve while i am trying below is;
example.com/fr/
should nothing changed as below;
example.com/fr/
however once i try;
example.com/frabcde/
it should turn to;
example.com/frabcde
should remove trailing slash at the end of.
Upvotes: 0
Views: 38
Reputation: 785306
You can use this rule in root .htaccess:
RewriteEngine On
RewriteRule ^((?!(?:fr|en)/).+?)/$ /$1 [L,NC,R=302]
Upvotes: 1