所有子域都路由到相同的DocumentRoot,apacheconfiguration

您已经在像basecamphq.com这样的网站上看到过,您将拥有username.basecamphq.com

我想做一个类似的事情,任何子域路由通过相同的index.php文件。

所以username1.example.com将请求/ home / some / path / to / www(在这里是index.php),username2.example.com将请求相同的文件

我有它在本地工作,但我的服务器使用cPanel。 你会猜测apache的configuration是什么?

<VirtualHost *:80> DocumentRoot /home/some/path/to/www ServerName www.example.com ServerAlias *.example.com </VirtualHost> 

像这样的事情,也许?