Jump to content

Virtual Hosts Aliases?


MrFish
 Share

Recommended Posts

I have a simple testing environment where I want to copy live sites to, do some large site-breaking tests, and push it back to the live copy. Surprisingly we don't have this where I work- it's a bit like the wild wild west here.

 

Anyway I've got a testing environment setup and I'm having trouble getting the virtual hosts setup.

 

I've got test.com working find going to /var/www/vhosts/test.com/httpdocs but I didn't think about what would happen if the site was www.test.com. Some of our sites force the www. in the htaccess for seo purposes so this is going to be a problem. I've been looking at apache virtual hosts and ServerAliases and stuff but I'm having trouble figuring out how to apply it to my situation. I don't want to have to define each virtual host so I've gotten away with adding this one line in my httpd.conf-

VirtualDocumentRoot /var/www/vhosts/%0/httpdocs

And now I'm stuck here-

VirtualDocumentRoot /var/www/vhosts/%0/httpdocs<VirtualHost *:80>        ServerAlias *.%0</VirtualHost>

Which doesn't make sense and doesn't work of course.

 

How can I create an alias that will accept all domains pointed to it with or without a www.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...