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

So I have a subdomain,, that is mapped to a directory located in the server's root: /subdomains/sub1/httpdocs/

I have another subdomain,, that is mapped to a different directory: /subdomains/sub2/httpdocs/

It's at a hosting company that won't let me alter Apache conf files.

I want to use the .htaccess file to allow sub2 requests to be processed by the files that are located in the sub1 directory. Almost like a symbolic link. I need to preserve the hostname. So would access the same file as, but the hostnames would be preserved.

I tried the following in /subdomains/sub2/httpdocs/.htaccess:

RewriteEngine On
RewriteRule ^(.*)$ /subdomains/sub1/httpdocs/$1

but I'm a getting internal server error.

Any suggestions?

share|improve this question
up vote 1 down vote accepted

The ^(.*)$ pattern captures the complete path component of the URL which always begins with a /, therefore you should probably remove the last / from your RewriteRule. This is how it should be:

RewriteEngine On
RewriteRule ^(.*)$ /subdomains/sub1/httpdocs$1

Or make the pattern match everything except the first /:

RewriteEngine On
RewriteRule ^/(.*)$ /subdomains/sub1/httpdocs/$1
share|improve this answer
So sorry I never marked answer as accepted. This one slipped through the cracks. :) – JonMcL Mar 24 '14 at 15:13

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.