Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VirtualHost/Server Name - Wildcards??

Status
Not open for further replies.

MarkerX

IS-IT--Management
Apr 15, 2003
6
US
Quick question..

I have 2 domain names, using 2 VirtualHost.

Everything works fine, unless you do not explicitly request the exact ServerName.. e.i.

" directs properly.
"domain1.com" directs properly.
" directs properly.
"domain2.com" DIRECTS to domain1...

I tried to use a wildcard, like
ServerName *domain2.com
But this does not work..

So I have to set up a VirtualHost for each domain with and without the "
And what about domain that you want to direct to the same directory, such as a ".net or .org", do you have to set up all of these as VirtualHost??

Help!
 
Use the "ServerAlias" directive.

Inside one VirtualHost directive do:

ServerName ServerAlias *.domain1.com

Perfection in engineering does not happen when there is nothing more to add. Rather it happens when there is nothing more to take away.
 
Correction.

You may have to say:

ServerName ServerAlias domain1.com *.domain1.com

to match just the domain name. Perfection in engineering does not happen when there is nothing more to add. Rather it happens when there is nothing more to take away.
 
Correction.

You may have to say:

ServerName ServerAlias domain1.com *.domain1.com

to match just the domain name. But, if foo.domain1.com resolves to that IP address, Apache should give you the right page. Perfection in engineering does not happen when there is nothing more to add. Rather it happens when there is nothing more to take away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top