Web Hosting Talk







View Full Version : apache url rewrite ?


slade
08-15-2001, 11:14 AM
I need to redirect traffic of of one of my servers onto another while I'm waiting for the nameservers to change.

I have a domain account, mysite.com, and a new domain account that will be mydomain.com as soon as the nameserver change propogates. I have a static IP.

Basically I want www.mysite.com/cgi-bin/asdf.cgi to get rewritten by apache into A.B.C.D/cgi-bin/asdf.cgi

I know its mod_rewrite, but I haven't found any really usable documentation on it.

Thanks,
Andrew Thompson

Voodoo Web
08-15-2001, 04:01 PM
RewriteEngine On
RewriteRule ^/(.*) http://255.255.255.255/$1 [P]

- domi

slade
08-15-2001, 07:30 PM
Argh...

That line doesn't work for me.

I found that this line will redirect, but doesn't keep the stuff after the first slash:

RewriteRule ^/* http://A.B.C.D/$1 [R, L]


I'm testing on Apache 1.3.20

jks
08-15-2001, 08:39 PM
Originally posted by slade
Argh...

That line doesn't work for me.

I found that this line will redirect, but doesn't keep the stuff after the first slash:

RewriteRule ^/* http://A.B.C.D/$1 [R, L]


I'm testing on Apache 1.3.20

Your regexp is wrong:

RewriteRule ^/(.*) http://A.B.C.D/$1 [R, L]

slade
08-15-2001, 11:34 PM
I know that my line doesn't match what VooDoo posted. When I used that line, there was no affect. It loaded the pages as per usual from the old server with no rewriting what so ever.

I played with several different commands for about an hour and the line I posted was the only thing I could get to run, and return a new address to the browser.