[wp-hackers] Bug or feature: Wordpress default rewrite rules cannot be overridden?

Austin Matzko if.website at gmail.com
Sun Dec 6 13:33:11 UTC 2009


On Sun, Dec 6, 2009 at 6:58 AM, Bjorn Wijers <burobjorn at gmail.com> wrote:
> However when this-is-a-random == an-existing-post-name it does not work
> instead it redirects to the single post template. BUT only when
> permalinks are switched on! If permalinks are off it still works.

I believe what you're seeing is a feature called "canonical redirect,"
which attempts to guess the correct destination for non-matching URLs.

> Basically what I want is
>
> First check my rules for blog posts and use these if they match
> otherwise continue with the default rules/behaviour, which it does for
> all strings not similar to an existing postname.

You should be able to disable canonical redirect like so:

remove_action('template_redirect', 'redirect_canonical');


More information about the wp-hackers mailing list