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.

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} ^(.+)?domain.com$
RewriteRule ^(/)?$ domain.com/$1 [L]

Pointing my browser to http://domain.com gives me the following error:

Not Found

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

However in my shell I can see this:

$ ls -al /[...]/htdocs/www/domain.com/
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

1 Answer 1

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

 
discard

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.