Fixing Dangerous Permalink Redirect Bugs
November 16, 2007
Since I have more than one occasion encounter bug with Permalink Redirect, I recommend people wait for new version of this plug-in.
The Bugs
The following are the bugs:
- Redirect "/feed" URI to "/feed/" using 302 redirect. Ignoring the "/%postname%" rule having no trailing slash.
- Redirect "/?paged=x" to "/page/x/" (where x is paging number) ingoring the fact ugly default URL is used, causing 404 message when paging.
There is no doubt about these bugs, because I test it by enabling and disabling Permalink Redirect plugin.
Fixing the bugs
Indeed being a programmer gives me some advantages, I could fix the bugs on the fly.
Feed redirect trailing slash
For the /feed to /feed/ redirect problem, I found these lines:
208 if (is_feed()) {
209 $link = trailingslashit($link) . 'feed/';
210 }
Solution:
- If want no trailing slash, remove the "/" on line 209.
- If it's WordPress 2.3.1+ simply remove the 3 lines because it's built-in.
- If you don't want to touch code, include the following in the Options > Permalink Redirect > Paths to be skipped: ".+/feed.*" (without the quotes)
Page redirect ignoring permalink rule
For the /?page=x to /paged/x/ problem, I found this line:
204 if ($paged)
205 $link = trailingslashit($link) . "page/$paged/";
Solution:
- If WordPress 2.3.1+, remove the lines because it's done better.
- If you don't want to touch code, include the following in the Options > Permalink Redirect > Paths to be skipped: ".+/?paged=.*" (without the quotes)
Conclusion
Even being buggy, and not recommended by WordPress 2.3.1 which claim having internal redirect, Permalink Redirect still provide some benefit that built-in redirect doesn't offer, such as:
- Redirect permalink from old structure to new structure
- Redirect broken, or wrong URL, providing the post id is correct, or enough matching words in post slug.
- Redirect feed url from "/?feed=rss" to "/feed" or "/feed/" depending your customization.
This plug-in is indeed getting a lot of my attention. I have more liking for it than the bult-in redirect. So, whenever I have time I will investigate deeper into the code and optimize it for better usage.

Subscribe via RSS

Thanks for clearing that up for me. I've been searching Google for the last 3 hours for a fix. Thanks!