Posted By

arnekolja on 03/04/11


url rewrite

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


.htaccess, point root to sub directory

 / Published in: Apache

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

Report this snippet  


RSS Icon Subscribe to comments
Posted By: arnekolja on March 4, 2011

This snippet not only lets the root point to the sub directory, but also makes it dependent on the domain name. I needed this for having a whole directory structure under a main domain, but having domain aliases using sub directories in it without the ability, to make each one a real vhost.

You need to login to post a comment.