[clue-tech] Simple (?) mod_rewrite problem

Jed S. Baer thag at frii.com
Sat Nov 18 18:45:22 MST 2006


In the process of moving to another web host, I'm at the stage of being
ready to wipe out the blog at the old host, but I'd like to redirect
requests to the new digs for as long as the account at the old site stays
active. So, I'm trying to use mod_rewrite from an .htaccess file, which
looks pretty simple for my purposes. So, here's the .htaccess file.

Options FollowSymLinks
RewriteEngine On
RewriteRule .*index\.php\?id=P([0-9]+)
http://freedomsight.net/index.php?p=$1 [R=permanent,L]

Where the URL to be rewritten is of the form:
http://s88369986.onlinehome.us/freedomsight/index.php?id=P1928
and all I need to do is capture the trailing digits, to plug into the new
URL.

Reading the Apache mod_rewrite docs and URL rewriting guide, this looks
(apparently) deceptively simple. For example, what I need to do seems, to
me, to be quite similar to the
http://httpd.apache.org/docs/trunk/rewrite/rewrite_guide.html "Move
Homedirs to Different Webserver" example.

I've tried many variations on the pattern, including using '%3F' for the
'?' in case the URL at that point is URL encoded. But I'm beginning to
think that the "URL" (uh, so to speak) which the pattern is used against
is just the path portion of the URL, and doesn't include paramters. So,
I'm continuing to read, but if anyone wants to jump in with some advice,
feel free.

jed
-- 
http://freedomsight.net/
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier



More information about the clue-tech mailing list