Page 1 of 1

two domains, one for each language

Posted: Tue Mar 09, 2010 1:30 pm
by brentnl
Hi, I have one website for a customer which has one hosted domain and one domain without any kind of hosting.

www.domain.nl
www.domain.com

I want to redirect everyone who uses the URL domain.com to domain.com/en_US/pagename.html.. this works with:

Code: Select all

# Link to http://website.com then redirect to http://www.website.com
RewriteCond %{HTTP_HOST} ^domain\.nl [NC]
RewriteRule ^(.*)$ http://www.domain.nl/$1 [R=301] 
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/en_US/$1 [L,R=301] 
But when someone types in: www.domain.com the URL isn't redirected... I tried several rules but with no effect. Can someone help me out?

Also; "[L,R=301] " .. that "L" stands for "last rule" or something right? Could it be possible that this letters is causing the problem because of no rule is processed anymore after this line..?

Re: two domains, one for each language

Posted: Thu Mar 18, 2010 3:09 pm
by brentnl
Nobody?

To make things clear:

1. domain.com and domain.nl has to be rewritten with WWW

2. www.domain.com has to be redirected to www.domain.com/en_US/

3. www.domain.nl has no need of a redirect.

Re: two domains, one for each language

Posted: Thu Mar 18, 2010 9:28 pm
by Peciura
When visitor types "www.domain.com " default page is opened right?
You could add this meta tag to "Page Specific Metadata:" field.

Code: Select all

<META http-equiv="refresh" content="0;URL=http://www.domain.com/en_US/"> 

Re: two domains, one for each language

Posted: Thu Mar 18, 2010 10:10 pm
by brentnl
Peciura wrote: When visitor types "www.domain.com " default page is opened right?
You could add this meta tag to "Page Specific Metadata:" field.

Code: Select all

<META http-equiv="refresh" content="0;URL=http://www.domain.com/en_US/"> 
www.domain.com has no hosting.. so this domain is redirected to domain.nl...

Re: two domains, one for each language

Posted: Mon Apr 12, 2010 5:33 am
by Augustas
This should work:

Code: Select all

RewriteCond %{HTTP_HOST} ^domain\.nl [NC]
RewriteRule ^(.*)$ http://www.domain.nl/$1 [R=301] 
RewriteCond %{HTTP_HOST} ^(www.)?domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/en_US/$1 [QSA,L,R=301]

Re: two domains, one for each language

Posted: Mon Apr 12, 2010 4:45 pm
by brentnl
Augustas wrote: This should work:

Code: Select all

RewriteCond %{HTTP_HOST} ^domain\.nl [NC]
RewriteRule ^(.*)$ http://www.domain.nl/$1 [R=301] 
RewriteCond %{HTTP_HOST} ^(www.)?domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/en_US/$1 [QSA,L,R=301]
It doesn't ... the domain isn't reachable at http://domain.nl ... and http://domain.nl/nl_NL/diensten.html isn't redirected to http://www.dom....

Also when I go to http://domain.com I get an error which says the website is redirected in a wrong kind of way...

Re: two domains, one for each language

Posted: Mon Apr 12, 2010 5:21 pm
by Augustas
For the .nl site should work this:

Code: Select all

RewriteCond %{HTTP_HOST} ^domain\.nl [NC]
RewriteRule ^(.*) http://www.domain.nl/$1 [QSA,L,R=301]
And this is for the .com site. A bit messy, but this is almost what I used in one website few years ago.
You might try to play with some lines, and maybe to make the whole block smaller. but if it works, just leave it as it is ;)

Code: Select all

RewriteCond %{HTTP_HOST} ^(www.)?domain\.com$ [NC]
# Don't loop.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/en_US/
# If its /, or
RewriteCond %{REQUEST_URI} ^/$ [OR]
# if it's not a real directory carry on.
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /en_US/$1 [QSA,L,R=301]