Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

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


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.