two domains, one for each language

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
Locked
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

two domains, one for each language

Post 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..?
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Re: two domains, one for each language

Post 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.
Peciura

Re: two domains, one for each language

Post 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/"> 
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Re: two domains, one for each language

Post 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...
User avatar
Augustas
Forum Members
Forum Members
Posts: 241
Joined: Wed Oct 17, 2007 6:09 pm
Location: the world

Re: two domains, one for each language

Post 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]
http://FollowTheRoad.com/ - living on the road...
http://www.kligys.com/ - asmeninis blog'as...
brentnl
Power Poster
Power Poster
Posts: 493
Joined: Mon May 11, 2009 4:35 pm

Re: two domains, one for each language

Post 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...
User avatar
Augustas
Forum Members
Forum Members
Posts: 241
Joined: Wed Oct 17, 2007 6:09 pm
Location: the world

Re: two domains, one for each language

Post 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]
http://FollowTheRoad.com/ - living on the road...
http://www.kligys.com/ - asmeninis blog'as...
Locked

Return to “[locked] CMSMS MLE fork”