Reputation: 11
I have a multilingual website in WordPress. It has IT and EN versions, and I want to change its default language to EN.
For SEO, I want to redirect all of the old URLs to new ones:
site.com/* to site.com/it/* (Except the main page) site.com/en/* to site.com/*
I want to add redirect rules in the .htaccess file. I tried too many times, and all of the codes caused a redirect chain. For example:
`RewriteEngine On
# Redirect from /en/* to /
RewriteCond %{REQUEST_URI} ^/en(/.*)?$
RewriteRule ^en(/.*)?$ /$1 [R=301,L]
# Redirect all other requests to /it/*
RewriteCond %{REQUEST_URI} !^/en(/.*)?$
RewriteCond %{REQUEST_URI} !^/it(/.*)?$
RewriteRule ^(.*)$ /it/$1 [R=301,L]
# Ensure no loop occurs by fixing /it/index.php redirection
RewriteCond %{REQUEST_URI} ^/it/index.php$
RewriteRule ^it/index.php$ /it/ [R=301,L]`
Would you please help me?
Upvotes: 0
Views: 37