[wp-hackers] Rewrite URIs Hack

Seamus Leahy leahy at au.org
Mon Nov 20 15:29:03 GMT 2006

First off, I have used WordPress for a while now but I am fairly new to the
hacking of it.

I am in the process of moving a blog over to WordPress and would like to use
some custom mod_rewrites to prevent breaking old links while being able to
move to a more logic URI scheme. Since I have not found an answer for how to
get WordPress 2 to handle custom rewrites, I worked on a little hack in

if ( ! isset($blog_id) )    $blog_id = 1; // START HACK // Fix for rewritten
URIS with mod rewrite if(!empty($_SERVER["REDIRECT_QUERY_STRING"]) &&
"/index.php"){    $_SERVER['REQUEST_URI'] = "/index.php"; } // END HACK //
Fix for IIS, which doesn't set REQUEST_URI if ( empty(

One thing that I know could cause issues is if WordPress is installed in a
different directory other than the root.  In addition, from my test
REDIRCT_QUERY_STRING is reflected in QUERY_STRING; but will this always be
the case?


More information about the wp-hackers mailing list