I have a multi-language site and one of them will be deleted shortly.
In order not to have 404, I would like to redirect automatically to the default language equivalent page.
Aka : www.example.com/fr/mypage -> www.example.com/mypage
and www.example.com/fr -> www.example.com/
I tried using routing and htaccess redirections (RewriteRule ^fr/(.*)$ /$1 [NC,R=302,NE]).
Has anyone had this issue?
Are your French and default language URLs identical or do you use URL-Keys?
In the first case, you could use two rewrite rules like this:
RewriteRule ^fr/(.*) /$1 [R=301,L]
RewriteRule ^fr / [R=301,L]
If you have used URL keys for the non-default language, this won’t work and you would have to rewrite all URLs manually or use Kirby routes .
Thanks Texnixe for the quick answer.
French is not my default language but I am not using url-keys (url are not translated).
I have other redirection rules on my .htaccess but placing those ones at the end make my site work like a charm.
Thanks again.
texnixe
October 19, 2016, 11:28am
4
Fine, glad that it works . And yes, the order of the rewrite rules is important.