Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

You've seen it done on sites like basecamphq.com where you would have username.basecamphq.com

I'm wanting to do a similar thing, any subdomain is routed through to the same index.php file.

so username1.example.com will request /home/some/path/to/www (in here is index.php) and username2.example.com will request the same file

I have it working locally, but my server uses cPanel. What would be your guess at the apache conifguration?

share|improve this question
up vote 1 down vote accepted
<VirtualHost *:80>
    DocumentRoot  /home/some/path/to/www 
    ServerName www.example.com
    ServerAlias *.example.com
</VirtualHost>

Something like that, perhaps?

share|improve this answer
    
worth noting that you'll also need wildcard DNS – James L Aug 12 '10 at 14:06

Your Answer

 
discard

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.