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?

link|improve this question

40% accept rate
feedback

2 Answers

up vote 0 down vote accepted
<VirtualHost *:80>
    DocumentRoot  /home/some/path/to/www 
    ServerName www.example.com
    ServerAlias *.example.com
</VirtualHost>

Something like that, perhaps?

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

Where for cPanel setup do you put this though? Like the OP, I have it working locally, but cPanel (which I have hosted with Hostmonster.com) doesn't seem to put any vhost.conf or other Apache files where I can edit them.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.