Virtual Hosts problems
September 28, 2010 4:32 AM Subscribe
Virtual Hosts are driving me insane. What am I doing wrong...?
I have example.com
I want example.com and www.example.com to be bounced to the main corporate site (examplecorp.com) and the rest of the subdomains to stay on the machine they went to originally. So, I have this (which works)
Any suggestions what this non SysAdmin is doing wrong?
I have example.com
I want example.com and www.example.com to be bounced to the main corporate site (examplecorp.com) and the rest of the subdomains to stay on the machine they went to originally. So, I have this (which works)
<VirtualHost *:80> ServerName www.example.com ServerName example.com Redirect 302 / http://www.examplecorp.com </VirtualHost> <VirtualHost *:80> ServerName sub1.example.com ServerAlias sub2.example.com DocumentRoot /var/www/html/codebase [...] </VirtualHost> [...]The thing is, I want to make it so that subdomains can be added automatically. I've tried changing ServerName to example.com or *.example.com and it's sending me to the CentOS default page.
Any suggestions what this non SysAdmin is doing wrong?
Only ServerAlias can take wildcards. ServerName is meant to be the one main name for that vhost, and as volatilebit says there should be only one per stanza.
posted by Rhomboid at 4:55 AM on September 28, 2010
posted by Rhomboid at 4:55 AM on September 28, 2010
Response by poster: Ah, fantastic. The following works nicely. Ta!
ServerName example.com
ServerAlias *.example.com
posted by twine42 at 5:46 AM on September 28, 2010
ServerName example.com
ServerAlias *.example.com
posted by twine42 at 5:46 AM on September 28, 2010
« Older My home will thank you for your podcast... | Have the job search methods laid out in What Color... Newer »
This thread is closed to new comments.
ServerName www.example.com
ServerAlias example.com
posted by volatilebit at 4:36 AM on September 28, 2010