.htaccess with multiple domains on 1 hosting package

Using a single web hosting account to host multiple sites

.htaccess with multiple domains on 1 hosting package

Postby ericyip » Sat Sep 09, 2006 5:52 pm

I use Dreamweaver and have a hosting package at Freeparking.co.nz

I have enough capacity to host several websites on my package and am told I can do this by modifying the .htaccess file.
I have one website www.Domain1.com in default host directory /var/www/html/
2nd website www.domain2.com website at folder at /var/www/html/wwwdomain2com/
3rd website www.domain3.com website at folder at /var/www/html/wwwdomain3com/

http://www.domain2.com currently maps to http://www.domain1.com.

I would like to redirect the 2nd domain http://www.domain2.com/ to the folder /var/www/html/wwwdomain2com/
I would like to redirect the 3rd domain http://www.domain3.com/ to the folder /var/www/html/wwwdomain3com/


I hope to have about 6 websites hosted on the one package.

How do I write a .htaccess file and where do I store it so it shows both websites, I presume I store it in /var/www/html/.
ericyip
 
Posts: 3
Joined: Sat Sep 09, 2006 5:29 pm

Postby richardk » Sun Sep 10, 2006 6:17 am

Leave the dots in the directory name (eg. www.domain2.com --> /var/www/html/www.domain2.com/).

Apache 1.3:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^(www\.)?domain1\.com$ [NC]
RewriteCond %{HTTP_HOST}  ^(www\.)?(.+)$ [NC]
RewriteRule ^(.*)$ /www.%1/$1 [QSA,L]


Apache 2.x:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

Postby ericyip » Sun Sep 10, 2006 2:02 pm

May be I need to be more precise in what I ask as I had a few issues. www.domain1.co.nz

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@domain1.net.au and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/2.0.49 (Fedora) Server at www.domain1.net.au Port 80

I have put changed the folder as
Leave the dots in the directory name (eg. www.domain2.co.nz --> /var/www/html/www.domain2.co.nz/).

I use Dreamweaver and have a hosting package at Freeparking.co.nz

I have enough capacity to host several websites on my package and am told I can do this by modifying the .htaccess file.
I have one website www.Domain1.net.au in default host directory /var/www/html/
2nd website www.domain2.co.nz website at folder at /var/www/html/www.domain2.co.nz/
3rd website www.domain3.tv website at folder at /var/www/html/www.domain3.tv/

http://www.domain2.co.nz currently maps to http://www.domain1.net.au.

I would like to redirect the 2nd domain http://www.domain2.co.nz/ to the folder /var/www/html/www.domain2.co.nz/
I would like to redirect the 3rd domain http://www.domain3.tv/ to the folder /var/www/html/www.domain3.tv/


I hope to have about 6 websites hosted on the one package.

How do I write a .htaccess file and where do I store it so it shows both websites, I presume I store it in /var/www/html/.
Last edited by ericyip on Sun Sep 10, 2006 7:22 pm, edited 1 time in total.
ericyip
 
Posts: 3
Joined: Sat Sep 09, 2006 5:29 pm

Postby ericyip » Sun Sep 10, 2006 7:18 pm

ericyip wrote:May be I need to be more precise in what I ask as I had a few issues. www.domain1.co.nz

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@domain1.net.au and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/2.0.49 (Fedora) Server at www.domain1.net.au Port 80

I have put changed the folder as
Leave the dots in the directory name (eg. www.domain2.co.nz --> /var/www/html/www.domain2.co.nz/).

I use Dreamweaver and have a hosting package at Freeparking.co.nz

I have enough capacity to host several websites on my package and am told I can do this by modifying the .htaccess file.
I have one website www.Domain1.net.au in default host directory /var/www/html/
2nd website www.domain2.co.nz website at folder at /var/www/html/www.domain2.co.nz/
3rd website www.domain3.tv website at folder at /var/www/html/www.domain3.tv/

http://www.domain2.co.nz currently maps to http://www.domain1.net.au.

I would like to redirect the 2nd domain http://www.domain2.co.nz/ to the folder /var/www/html/www.domain2.co.nz/
I would like to redirect the 3rd domain http://www.domain3.tv/ to the folder /var/www/html/www.domain3.tv/


I hope to have about 6 websites hosted on the one package.

How do I write a .htaccess file and where do I store it so it shows both websites, I presume I store it in /var/www/html/.
ericyip
 
Posts: 3
Joined: Sat Sep 09, 2006 5:29 pm

Postby richardk » Mon Sep 11, 2006 10:50 am

Why did you quote your own post? I'll answer when i have time!
What does you error log say about the error?

Replace
Code: Select all
/www.%1/$1

with
Code: Select all
/www.%2/$1

in both.

Also try them without the Options line.
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 18 guests

cron