Virtual Hosts problems
-
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)<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?
-
Answer:
As far as I know, you can only have 1 ServerName per Virtual Host. You need ServerAlias: ServerName www.example.com ServerAlias example.com
twine42 at Ask.Metafilter.Com Visit the source
Other answers
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.
Rhomboid
Ah, fantastic. The following works nicely. Ta! ServerName example.com ServerAlias *.example.com
twine42
Related Q & A:
- Where Is The Website For My Virtual Home?Best solution by Yahoo! Answers
- Where To Buy Virtual Credit Card Online?Best solution by Yahoo! Answers
- How To Upload To Multiple Hosts?Best solution by technet.microsoft.com
- How do I clean Windows hosts file?Best solution by precisesecurity.com
- Virtual HS problems please help?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.