Rewriting subdomain to subfolder with htaccess
Posted
by Owen Allen
on Stack Overflow
See other posts from Stack Overflow
or by Owen Allen
Published on 2010-06-11T01:32:53Z
Indexed on
2010/06/11
1:43 UTC
Read the original article
Hit count: 409
I'm attempting to use .htaccess in the root folder of an Ubuntu/Apache2 server in order to mask a subdomain to subfolder and I keep getting a 500 Internal Error. I know that I'm doing something stupidly wrong and it is some silly error causing the problem. I've checked all of the similar threads on SO and online and whenever I try their advice the 500 continues.
Here's my code.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^admin\.mydomain\.com.*$
RewriteRule (.*) intranet/$1 [L]
What I want to occur is that if a user visits admin.mydomain.com they will get the contents of the folder admin.mydomain.com/intranet/ but their URL bar will still be admin.mydomain.com. Any idea what I'm doing wrong?
In addition, some of the threads online talked about possible problems with this system. Is this the best way of doing this masking, should I be using a vhost setup?
© Stack Overflow or respective owner