[wp-testers] Query strings confuse rewrite permalinks

Mark Jaquith mark.wordpress at txfx.net
Wed Aug 10 01:35:57 GMT 2005


Andy Skelton wrote:

>After getting beat up time and again by the complexities of WP_Rewrite
>et al, I decided to continue using query strings and simply hide the
>fact from WP. The plugin strips $_SERVER['QUERY_STRING'] and
>$_SERVER['REQUEST_URI'] of any related query strings with
>preg_replace, leaving $_GET fully intact.
>
>Whereas before this URL would boot me to the home page, now it gives
>me the correct post:
>http://www.andyskelton.com/2005/08/08/testing-botd/?botd=nocache
>
>However, I am only stripping botd values. This URL still breaks the
>rewrite system and sends me to the home page:
>http://www.andyskelton.com/2005/08/08/testing-botd/?foo=bar
>
>At the risk of sounding insolent, I think query strings are invaluable
>and should be tolerated by the rewrite system. Is it the intention to
>let a permalink rewrite URL be invalidated by appending an
>unrecognized query string or is that a bug?
>
Yeah... I think we can safely call that a bug!  The problem likely 
exists in 1.6 because the mod_rewrite rules have been changed to use the 
PATHINFO method.  e.g., you request 
http://site.com/2005/01/01/entry-title/ and mod_rewrite sends that 
request to http://site.com/index.php/2005/01/01/entry-title/ where WP 
will process it.  What WP should do is strip everything after ? before 
processing it.  Those things will still be in the $_GET and $_REQUEST 
arrays, so your plugin should be able to process them fine.

/index.php/blah style URIs have never been properly supported to my 
knowledge... there's always been something wonky about them, be it 
pages, or feeds, or something else.  But now that it is the default 
method in WP 1.6, we're going to have to make sure they work flawlessly.

-- 
Mark Jaquith
http://txfx.net/
MCincubus @ #wordpress



More information about the wp-testers mailing list