bourax webmaster
bourax webmaster

Reputation: 733

.htacess redirect 301 doesn't work properly

I have issue to redirect 301 URLs,

I want to redirect from fr.example.com/fr to www.example.com/fr-ch the rest of the URL doesnt have always same structure but htaccess redirect to same structure, exemple:

RewriteCond %{HTTP_HOST} ^fr\. [NC]
Redirect 301    /fr   https://www.example.com/fr-ch         
Redirect 301    /fr/coffee/arabica-robusta  https://www.example.com/fr-ch/ccc/arabica-robusta

what I get as result is redirect to https://www.example.com/fr-ch/coffee/arabica-robusta

and not to

https://www.example.com/fr-ch/ccc/arabica-robusta

Am I missing something ??

Upvotes: 0

Views: 16

Answers (1)

user2997418
user2997418

Reputation: 658

You need to redirect EXACTLY /fr, so you need to add ^ in the beginning and $ at the end.

So this should work :

Redirect 301    ^/fr$   https://www.example.com/fr-ch         

Upvotes: 1

Related Questions