httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: [users@httpd] Domain redirect with browser location change
Date Fri, 18 Jun 2004 18:05:23 GMT

On Fri, 18 Jun 2004 RBaker@safehorizon.org wrote:
> Hmmm... alright.  I guess my main point of confusion about this is, will
> that definitely change the browser location?

Yes.  That is the one and only point of this example.

> Also, is there any way to
> modify this so that any domain other than [www.]safehorizon.org is
> redirected?

The first-listed virtual host will catch any requests that don't match any 
listed ServerName/ServerAlias.  Hence by doing the Redirect in the first 
<VirtualHost> block (as in the example), all unknown names will also be 
redirected.

> I
> suppose we could detail every domain name we expect, but can we add a
> catchall VirtualHost, such that links to
> http://www.safehorizon.org/mypage.html pass striaght through to that exact
> address, but a link to that machine using any other domain gets redirected
> to the home page (i.e. even if it's
> http://norealdomain.net/norealpage.html)?

Now you are asking for three different behaviors, so you'll need three 
<VirtualHost> sections, as follows:

> NameVirtualHost *

<VirtualHost *>
# Catch any unlisted names and redirect to the homepage.
# (RedirectMatch does not automatically tag on the path
# to the target like Redirect does.)
# Note that the ServerName is irrelevant, but must be
# set to something.
ServerName catch-all 
RedirectMatch permanent .* http://www.safehorizon.org/
</VirtualHost>

>
> <VirtualHost *>
>   ServerName www.victimservices.org
>   ServerAlias victimservices.org
>   Redirect permanent / http://www.safehorizon.org/
> </VirtualHost>
>
> <VirtualHost *>
>   ServerName www.safehorizon.org
>   ServerAlias safehorizon.org
>   DocumentRoot /path/to/www/root
> </VirtualHost>
>
> Is that right?

Yep.

---------------------------------------------------------------------
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