I want my subdomain to point directly to a folder. That is if an HTTP request is made to apple.example.com, I want the response to be the contents of example.com/apple/index.html, but not a 301 error. Is it possible?
A:
Yes, this is exactly the purpose of tools like ISAPI_REWRITE. My hosting company (orcsweb) uses exactly this technique.
-OIsin
x0n
2009-10-12 16:03:57
A:
# Internally rewrite <subdomain>.example.com/<URLpath> to example.com/subs/<subdomain/<URLpath>
RewriteCond $1 !^subs/
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
RewriteRule (.*) /subs/%1/$1 [L]
Dutow
2009-10-12 16:10:30
I have already found this solution on the net.But it does not work for me.The following error is displayed in the browser when I navigate to apple.example.com----Not FoundThe requested URL / was not found on this server.
Pavel
2009-10-12 16:51:15
Do you know why I get this error?
Pavel
2009-10-12 16:55:14
A:
You can serve content from any folder or you can send a redirect to the client, but AFAIK you cannot do both at the same time - you cannot serve content and somehow change the url in browser at the same time.
If it would be possible, it would most definitely lead to many security exploits.
qbeuek
2009-10-12 16:15:56