httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nils Jeppe <n...@pandemonium.de>
Subject Re: [users@httpd] mod_rewrite redirecting multiple domain names to the one name
Date Fri, 29 Feb 2008 07:28:21 GMT


On Fri, 29 Feb 2008, Viv D-F wrote:

> I figure this is a fairly common problem, but I haven't been able to find
> any examples of how this is usually done.  I'm not convinced that this is
> best done in the Apache config.  Is this done at the DNS instead?

There are, I think, three ways to do this. The first is what you're 
thinking of, find an example here:

http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html#canonicalhost

Secondly, setting "UseCanonicalName on" may work to redirect you to the 
correct hostname. I never use this myself, but I remember vaguely that it 
does something like this. I am not entirely sure of course, but you could 
easily test it yourself:

http://httpd.apache.org/docs/2.2/mod/core.html#usecanonicalname

Thirdly, you could simply add one or more extra virtualhost(s) which takes 
care of all the "extra" hostnames and do a simple RedirectPermanent / 
http://site1.com/ or something similar in its configuration. This last 
solution is especially useful if you'd like to easily log the access / 
referrers to the "unwanted" site names.



Best wishes
- Nils


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message