Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a domain that redirects to a sub folder like so www.domain.com/blog

RewriteEngine on

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

However I would like to hide the /blog I have reviewed the Apache documentation but I am unsure how to complete this. The reason why I need this is because I have three domains that point to the same IP address that have different sub folders for the different domains.

In addition if I have the other domains would I use the following:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ blog [L]
RewriteCond %{HTTP_HOST} ^(www.)?domain2.com$
RewriteRule ^(/)?$ blog2 [L]
RewriteCond %{HTTP_HOST} ^(www.)?domain3.com$
RewriteRule ^(/)?$ blog3 [L]

Would this be a valid .htaccess?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I think you're making this too complicated. Set up apache with one VirtualHost section for each site and each VirtualHost will have it's own DocumentRoot folder that points to the appropriate blog folder.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.