Jump to content
The Uniform Server Community
Sign in to follow this  
jafo

mutiple url's to one folder

Recommended Posts

Have a problem here. Have two urls, www.example1.com & www.example2.com. Created two virtual hosts and pointed them both to /www/example. Problem is that www.example1.com resolves just fine, but www.example2.com opens http://localhost/ ... from the outside.

 

##########VIRTUAL HOST SETUP##########

# example1

<VirtualHost *>

ServerName example1.com

DocumentRoot c:/UniServerX.X/www/example

ServerAlias www.example1.com

</VirtualHost>

 

##########VIRTUAL HOST SETUP##########

# example2

<VirtualHost *>

ServerName example2.com

DocumentRoot c:/UniServerX.X/www/example

ServerAlias www.example2.com

</VirtualHost>

 

The folder contains a wordpress installation.

 

Any Ideas? TIA

Share this post


Link to post
Share on other sites

I cannot see a problem with your VirtualHost sections. They both look correct and should resolve to folder example.

 

I have talked myself out of a number of things I was going to suggest.

Both urls map to your server; site 1 is resolved while site 2 is not resulting in the default Vhost being used instead.

 

It just looks inconsistent I was wandering if site 2 is correctly resolved and wordpress mangles the response.

 

A quick test would be to create an index.html test file and place it in folder example. If that file is accessible from both urls, it proves there is nothing wrong with the vhosts.

 

It would indicate you set-up wordpress from site 1 and when accessed from site 2 it expects a site1 access.

 

I hope that makes sense, just trying to isolate where the problem is.

 

All the best

Ric :D

Share this post


Link to post
Share on other sites

Is this line uncommented?

 

#NameVirtualHost *

Share this post


Link to post
Share on other sites

Is this line uncommented?

 

#NameVirtualHost *

 

I apologise for the delay, OK for some reason I missed your follow up question! :)

Anyway by now you will have discovered that you do need to uncomment that line. :(

 

What may be of interest if you have several domains that map to a single ip address that in turn maps to a single root folder you only need one virtual host!

 

For example:

 

 NameVirtualHost *
 <VirtualHost *> 
 ServerName  fred.com 
 ServerAlias www.fred.com 

 ServerAlias example1.com www.example1.com 
 ServerAlias example2.net www.example2.net 
 ServerAlias info.biz www.info.biz more.info.biz 
 # etc. 

 DocumentRoot c:/UniServerX.X/www/example 
</VirtualHost>

 

The above domains fred.com, example1.com, example2.net and info.biz all map to the same site that is contained in the root folder c:/UniServerX.X/www/example as do their sub-domains www and more.

 

All the best

Ric B)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...