Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: I'm strugling with virtual servers configuration... help |
|
Author |
|
mnjh
Joined: 15 Mar 2009 Posts: 1
|
Posted: Sun 15 Mar '09 8:31 Post subject: I'm strugling with virtual servers configuration... help |
|
|
Hi people
I'm trying to map the domains this way:
site1.com/* -> www.site1.com/*
site1.net/* -> www.site1.com/*
*.site1.com/* -> *.site1.com/*
*.site1.net/* -> *.site1.com/*
site2.com/* -> www.site2.com/*
site2a.com/* -> www.site2.com/*
*.site2.com/* -> *.site2.com/*
*.site2a.com/* -> *.site2.com/*
etc.
So, most sites have aliases and I want the aliases to change to the main site domain, and all subdomains to point to the main index.
I managed to do it for one site (code is below), but I'm having trouble when I add more sites, some of them get redirected to site1
I'm sure there is a good way to do this... I'll appreciate any help
Code: | ServerName www.site1.com
ServerAlias site1.com *.site1.com site1.net *.site1.net
DocumentRoot /var/www/site1.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site1\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^site1\.net [NC,OR]
RewriteCond %{HTTP_HOST} ^([a-z0-9]*)\.site1\.net [NC,OR]
RewriteCond %{HTTP_HOST} ^([a-z0-9]*)\.site1\.com [NC]
RewriteCond %{HTTP_HOST} !www\.site1\.com [NC]
RewriteRule ^/(.*) http://www.site1.com%2/$1 [L,R=301] |
|
|
Back to top |
|
|
|
|
|
|