I’m trying to make a redirection based on the domain name of my website.
I have two urls:
- domain-english.com
- domain-french.com
The default language is english so when users type domain-english.com no redirection is needed.
But when users type in domain-french.com, I would like it to go directly to domain-french.com/fr
In my htaccess file I tried different solutions I found on Google.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain-french.com [OR]
RewriteCond %{HTTP_HOST} ^www.domain-french.com
RewriteRule ^(.*)$ http://www.domain-french.com/fr [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress
This does redirect to the url domain-french.com/fr but I get this error
The page isn’t redirecting properly
EDIT
I also tried this configuration in my .htaccess file but I get a 500 Server Error.
RewriteCond %{HTTP_HOST} ^(www.)?domain-french.com
Rewriterule ^(.*)$ http://www.domain-french.com/fr [L]
Any ideas what’s happening?
Thanks
Just contacted my hosting provider, they said that it is prohibited on their server thus explaining why it doesn’t work. Thanks anyway for the help! –