Translations Cloud
Translations Cloud

Reputation: 53

301 permanent redirection to remove a parametre

My problem is really simple but I really can't find a solution (even if I am not new with .htaccess configuration)

this is what I tried

#ENGLISH CORRECTION
RedirectMatch 301 ^en/(.*)/?$ $1

I have a multilingual website accessible from https://www.domain.com/<language>/<page>

I would like to have the <language> parameter only for languages different than english.. so what I would like to have is that

if <language> == en
301 redirect from /en/<page> to /<page>

Any idea on how to implement the system above ?

thanks in advance!

Upvotes: 1

Views: 40

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

You have the right idea, but with mod_alias (the Redirect and RedirectMatch directives), you need to match the leading slash:

#ENGLISH CORRECTION
RedirectMatch 301 ^/en/(.*)/?$ $1

Upvotes: 2

Related Questions