Page 1 of 1

Apache Dynamic Doc Root Based On Domain

Posted: Fri May 18, 2012 8:39 am
by shiznatix
So my web host right now is a bit silly and no matter how many domains you have, you can only have 1 document root. Horrible but it is what I have to deal with right now.

I am trying to break it up a bit though with some mod_rewrite stuff with sub folders like this (folder structure):
public_html/domain.com/
public_html/domainTwo.com/

and the .htaccess in public_html/ would look like this:
[text]
RewriteEngine On

RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !domain.com/
RewriteRule (.*) /domain.com/$1 [L]

RewriteCond %{HTTP_HOST} ^domainTwo.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domainTwo.com$
RewriteCond %{REQUEST_URI} !domainTwo.com/
RewriteRule (.*) /domainTwo.com/$1 [L]
[/text]

Now this seams to be working to an extent but not fully. Under domain.com, I have another folder, admin/, but whenever I try to go to this folder (it has it's own .htaccess file also but with nothing exciting) I just get the same public_html/domain.com/ files. I can't access anything under this directory (or others with an .htaccess file in them).

Is there something I am missing or being stupid about?