htaccess redirect from subdomain to root

Posted by Erin on Stack Overflow See other posts from Stack Overflow or by Erin
Published on 2010-04-22T19:38:24Z Indexed on 2010/04/22 19:43 UTC
Read the original article Hit count: 339

Filed under:

I'm hosting several domains on one account, and I currently have a RewriteRule set to redirect the root url (www.root.com) to a subdirectory (/public_html/root/).

However, I have few directories in the root (/public_html/xyz/) that I would like to access from the root url (www.root.com/xyz). Is this possible to write a redirect for this, or do I have to place these folder in the /public_html/root/ directory?

This is what I have for the .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?root.com$
RewriteCond %{REQUEST_URI} !^/root/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTP_HOST} ^(www.)?hamiltonmehta.com$
RewriteRule ^(/)?$ hamiltonmehta/index.php [L]

Thanks in advance!

© Stack Overflow or respective owner

Related posts about htaccess