I am looking for a way to have multiple-level subdomains on a server running Apache2.2 and PHP5. Ideally the solution will be in Apache and not PHP.
For instance:
www.apps.example.com OR test.apps.example.com
I've seen this on commercial sites before but have not seen any solutions for how to implement this. I essentially want to allow users to either enter www before any subdomain or just to enter the subdomain without the www's. so both x.example.com and www.x.example.com resolve to the same directory.
I am running CentOS 5.4 & Ubuntu 8.04, PHP 5.2.10 & Apache 2.2
Thanks
You can dynamically add entries into apache config files using a PHP language, But remember you are living on edge of uncertainty
// add this to your httpd.conf
Include extra/httpd-vhosts.conf
// add this to extra/httpd-vhosts.conf
<VirtualHost *:80>
// with www prefix
DocumentRoot /www/example/x
ServerName x.example1.com
ServerAlias www.x.example1.com
</VirtualHost>
<VirtualHost *:80>
// without www prefix
DocumentRoot /www/example/x
ServerName x.example1.com
</VirtualHost>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With