httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nate" <nate.li...@tbh.info>
Subject Re: Rewriting a URL
Date Mon, 03 Jun 2002 17:35:09 GMT
I wanted to try and do this without having to use redirects. The link you
gave me actually had the link to the mod_rewrite page I originally studied.
Obviously, I didn't look hard enough, because adding the following to my
virtual host re-wrote all ServerAliases I had on the VirtualHost:
RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^/(.*)
http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]
RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)         http://fully.qualified.domain.name/$1 [L,R]

Thanks for the help!

Nate D.

----- Original Message -----
From: "Joshua Slive" <joshua@slive.ca>
To: "Apache List" <users@httpd.apache.org>
Sent: Monday, June 03, 2002 1:13 PM
Subject: Re: Rewriting a URL


>
> On Mon, 3 Jun 2002, Nate wrote:
>
> > The problem is that I don't completely understand the expressions, and
the
> > info I have found on various sites just don't seem to explain it so it
> > clicks. Is there a simpler way to say something like "take all
domains/hosts
> > that are aliased to this virtual host and re-write them as
www.domain.com" ?
>
> Yes: http://httpd.apache.org/docs/misc/FAQ.html#canonical-hostnames
>
> <VirtualHost *>
> ServerName www.example.org
> ServerAlias www.example.net www.other.example.com
> Redirect permanent / http://www.example.com/
> </VirtualHost>
>
> If you list this virtual host first, it will pick up ALL hostnames
> that aren't otherwise matched and forward them to www.example.com.
>
> Joshua.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message