help this n00b creating a htaccess file for 2 domains

Using a single web hosting account to host multiple sites

help this n00b creating a htaccess file for 2 domains

Postby euner » Wed Oct 04, 2006 5:14 am

Ok, here is my problem:

I am using two domainnames:

- www.domainone.nl
- www.domaintwo.nl

at default the domaintwo.nl loads the content at domainone.nl (so actually I have two domains with the same website)

now I have a directory --> www.domainone.nl/website/

how can I forward www.domaintwo.nl to www.domainone.nl/website/

and where do I put the htaccess file? in root of domainone.nl or in the /website/ directory?

Thanks in advance
euner
 
Posts: 2
Joined: Wed Oct 04, 2006 5:06 am

Postby richardk » Wed Oct 04, 2006 5:47 am

Put the following in a .htaccess file in domainone.nl's document root (not /website):
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domaintwo\.nl$ [NC]
RewriteRule !^website(/.*)?$ /website%{REQUEST_URI} [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby euner » Wed Oct 04, 2006 6:13 am

Thanks m8 it's perfect!!

1 question left, is it also possible to add a rule that it automatically adds www. before the 2 adresses if you only type http://domainone.nl or http://domaintwo.nl ?

because now I have a problem with cookies because www. is not in the address
euner
 
Posts: 2
Joined: Wed Oct 04, 2006 5:06 am

Postby richardk » Wed Oct 04, 2006 7:50 am

This:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(domainone|domaintwo)\.nl$ [NC]
RewriteRule ^(.*)$ http://www.%1.nl/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.domaintwo\.nl$ [NC]
RewriteRule !^website(/.*)?$ /website%{REQUEST_URI} [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 39 guests

cron