You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John Nichel <jo...@kegworks.com> on 2004/09/21 17:39:06 UTC
Re: [users@httpd] mod_rewrite to rewrite host name [SOLVED]
John Nichel wrote:
> Hi,
>
> I'm trying to do a 301 redirect to all traffic coming to on FQDN to
> another....
>
> RewriteEngine On
> RewriteCond %{HTTP_HOST} !^test\.kegworks\.com [NC]
> RewriteCond %{HTTP_HOST} !^$
> RewriteCond %{SERVER_PORT} !^80$
> RewriteRule ^/(.*) http://www.kegworks.com:%{SERVER_PORT}/$1
> [QSA,R=301][OR]
> RewriteCond %{HTTP_HOST} !^test.kegworks.com [NC]
> RewriteCond %{HTTP_HOST} !^$
> RewriteRule ^/(.*) http://www.kegworks.com/$1 [QSA,R=301]
>
> Basically, I want to send all 'test.kegworks.com' traffic to
> 'www.kegworks.com', with the path (and any query strings) in tact.
> However, with the above ruleset in place, any URL I click on for
> test.kegworks.com goes to test.kegworks.com, with no redirect at all.
> I'm sure I'm missing something simple, but I just can't see it. TIA
>
Got it to work....
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test.kegworks.com [NC]
RewriteRule ^(.*)$ http://www.kegworks.com/$1 [QSA,R=301]
--
John C. Nichel
KegWorks.com
716.856.9675
john@kegworks.com
---------------------------------------------------------------------
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