I’m currently redirecting all requests for http://www.example.com to example.com.
I have this working nicely with this code found elsewhere on stackoverflow:
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
So far so good.
The problem I have is that I also need to ensure that the Spanish version of my site also redirects — http://www.example.com/es needs to redirect to example.com/es, but this doesn’t work with the code shown above.
What would I need to add to make the redirection work?
Thanks for your help!
Inside your example.com/es/ folder, create a .htaccess file with the following contents:
(Reference)