Multiple Domains & Document Roots Issues

Using a single web hosting account to host multiple sites

Multiple Domains & Document Roots Issues

Postby richardo » Wed Jul 15, 2009 1:24 pm

Hello,

I currently have multiple domains pointed to my hosting account with each domain having its own document root:

mainsite -> /home/user/public_html/
site1.com -> /home/user/public_html/site1
site2.com -> /home/user/public_html/site2

.htaccess (home/user/public_html/)

Code: Select all
RewriteEngine on
Options +FollowSymlinks

RewriteCond %{HTTP_HOST} ^(www\.)?site1\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/site1%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

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


.htaccess(home/user/public_html/site1)

Code: Select all
RewriteEngine on
Options +FollowSymlinks

RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L]
RewriteRule ^venues/([^/\.]+)/?$ /index.php?page=venues&venue_name=$1 [L]
RewriteRule ^gallery/([^/\.]+)/?$ /index.php?page=gallery&event_name=$1 [L]
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/?$ /index.php?page=gallery&event_name=$1&photo=$2 [L]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)?$ /index.php?page=$1&date=$2&day=$3&event_name=$4 [L]



When site1.com is requested the content is loaded from the required document root e.g site1.com -> /home/user/public_html/site1. However, if site1.com/events is requested content is attempted to be loaded from the mainsite directory instead of as per the rewrite rule in home/user/public_html/site1

Any help would be much appreciated.

Richard
richardo
 
Posts: 2
Joined: Tue Jul 14, 2009 3:48 pm
Location: Oxford, UK

Postby richardk » Wed Jul 15, 2009 1:36 pm

Try removing the slash from in front of index.php.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby richardo » Wed Jul 15, 2009 1:51 pm

Seems to have solved the problem!

Many thanks :)
richardo
 
Posts: 2
Joined: Tue Jul 14, 2009 3:48 pm
Location: Oxford, UK


Return to Domain Handling

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron