Please help!

Using a single web hosting account to host multiple sites

Please help!

Postby blopster » Sun Jan 28, 2007 9:07 am

I have a website that i purchased a while ago and have recently added two more domains onto it.

My problem is:

site1.com is the main site.
site2.com is the second site.
and site3.com is the third site.

in the root directory to site1.com there is two folders that contain the two other sites in them:
site2.com is located at site1.com/g and site3.com is located at site1.com/dry. When you type in site2.com/anyfolder it redirects to site1.com/g//anyfolder and the same with site3.com.

Can someone please help me figure out a mod_rewrite for my .htaccess that will allow me to have other subfolders in my /dry/ or /g/ sub-directory without it showing the main domain (site1.com).
blopster
 
Posts: 31
Joined: Wed Dec 20, 2006 1:33 pm
Location: U.S.

Postby richardk » Sun Jan 28, 2007 12:09 pm

Does it redirect if you include the trailing slash? Try putting the following in a .htaccess file in site1.com's document root:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{DOCUMENT_ROOT}/g%{REQUEST_URI} -d [OR]
RewriteCond %{DOCUMENT_ROOT}/dry%{REQUEST_URI} -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]
Last edited by richardk on Sun Jan 28, 2007 1:30 pm, edited 1 time in total.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

not working

Postby blopster » Sun Jan 28, 2007 12:26 pm

With that code you gave me, i type www.site2.com or www.site3.com and it just shows www.site1.com's content but with the right address in the address bar.
blopster
 
Posts: 31
Joined: Wed Dec 20, 2006 1:33 pm
Location: U.S.

Postby richardk » Sun Jan 28, 2007 12:30 pm

I assumed you had that much working already.

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{DOCUMENT_ROOT}/g%{REQUEST_URI} -d [OR]
RewriteCond %{DOCUMENT_ROOT}/dry%{REQUEST_URI} -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

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

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?site3\.com$ [NC]
RewriteRule ^(.*)$ /dry/$1 [QSA,L]
Last edited by richardk on Sun Jan 28, 2007 1:30 pm, edited 1 time in total.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

not working

Postby blopster » Sun Jan 28, 2007 12:33 pm

the site now shows up when you type it in but everything in the /g/ and /dry/ folders are not working. like the css.
blopster
 
Posts: 31
Joined: Wed Dec 20, 2006 1:33 pm
Location: U.S.

i think i figured out the problem

Postby blopster » Sun Jan 28, 2007 12:40 pm

the css page in the root directory of site1.com is affecting the other two sites. The other two sites are using the css document form the root folder instead of the css documents in the /g/ and /dry/ folders.
blopster
 
Posts: 31
Joined: Wed Dec 20, 2006 1:33 pm
Location: U.S.

Postby richardk » Sun Jan 28, 2007 12:46 pm

I don't see how the mod_rewrite can be doing that. What are the paths to the CSS like (in the source of the page)?

If the path in the source isn't the problem, could you post a link (or PM it to me if you don't want to post it)?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

ok

Postby blopster » Sun Jan 28, 2007 1:24 pm

ok nevermind. now it works. Thanks very much once again
blopster
 
Posts: 31
Joined: Wed Dec 20, 2006 1:33 pm
Location: U.S.


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 11 guests

cron