How can I configure Apache to automatically map a sub-domain to a directory?

Posted on Jul 01, 2008 under domain news and reports | 2 Comments

Essentially I want to be able to browse to http://mysub.example.com to remap to http://example.com/mysub/ but have it work for any subdomain off of example.com.

2 Responses to “How can I configure Apache to automatically map a sub-domain to a directory?”

  1. orvado_technologies Says:

    You should look into using the mod_rewrite module to rewrite your URLs. You can use a regulare expression match to get the subdomain name and then translate this into the desired location so that something like http://test1.example.com becomes http://www.example.com/test1.

    Regular expressions are kind of tricky so I would just Google for a solution to this – I bet it's been done many times before.

  2. artificial christmas tree…

    That is really interesting, You are an excessively professional blogger. I’ve joined your feed and look forward to looking for extra of your excellent post. …

Leave a Reply