Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To redirect a specific domain name to a folder in my public dir, www/, I edited .htaccess to the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)?$
RewriteRule ^(/)?$$1 [L]

Pointing my browser to gives me the following error:

Not Found

The requested URL /[...]/htdocs/www/ was not found on this server.

However in my shell I can see this:

$ ls -al /[...]/htdocs/www/
total 4
drwxr-xr-x+ 2 user group 3 2012-11-30 12:04 .
drwxr-xr-x+ 8 user group 9 2012-11-30 12:03 ..
-rw-r--r--+ 1 user group 4 2012-11-30 12:04 index.php

Editing .htaccess to point directly to index.php gives the result. An empty .htaccess file points correctly to the root directory.

What am I missing?

share|improve this question

Via this link I found the proper rules:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/subdirectory/
RewriteCond %{HTTP_HOST} ^(www\.)?name\.
RewriteRule ^(.*)$ subdirectory/$1 [L]

Please see the link itself for a full explanation on proper usage.

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.