views:

79

answers:

4

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
A: 

Yes, but you need to make sure that your server is able to support virtual domains. I don't know enough about this, but the mod_rewrite is possible without redirects.

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
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
Do you know why I get this error?
Pavel
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