apache domain redirect to subfolder

Posted by Dennis on Pro Webmasters See other posts from Pro Webmasters or by Dennis
Published on 2011-02-21T01:13:32Z Indexed on 2011/02/21 7:32 UTC
Read the original article Hit count: 341

I have a hosting account with godaddy. Its a linux system running apache. The way they do their setup is your primary domain is the root folder. When you add a subdomain its in a subfolder of the root which sucks. I want to setup a subfolder structure to organize my domains.. I called godday support and they said to use redirects.. but did not know how to do that..

How its setup now:

primary domain:

www.domain.com /
sub.domain.com /sub

I want to create a directory structure and then redirect to each but only show www.domain.com in the url

www.domain.com /domain/www
sub.domain.com /domain/sub

I tried using:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ domain/www [L]

but it just changes the url to www.domain.com/domain/www

Can this be done in htaccess?

© Pro Webmasters or respective owner

Related posts about mod-rewrite

Related posts about url-rewriting