stecog
stecog

Reputation: 2344

Remove part of URL with RewriteRule

I need remove prefix /en from all URL, eg.

www.mydomain.com/en/foo/bar/index.html -> www.mydomain.com/foo/bar/index.html

I've tried with:

RewriteRule ^/en/(.*) /$1 [L]

or

RewriteRule ^/en/\d+-(.+) /$1 [R,L]

but nothing happens

Upvotes: 3

Views: 8750

Answers (1)

Croises
Croises

Reputation: 18671

You can use in your .htaccess:

RewriteEngine on 
RewriteRule ^en/(.*) /$1 [NC,L]

Because in .htaccess, RewriteRule first URL never starts with /

Upvotes: 6

Related Questions