I have a WordPress 3.2.1 site hosted on a DreamHost shared Debian/Apache server. Since I set up the site two years ago, it's been set to the /%year%/%monthnum%/%postname%/ permalink structure. It was also redirecting URLs like /?p=204 and /?page_id=1836 to their "pretty" counterparts.

Now, however, I'm seeing entries in my statistics packages (Piwik & Google Analytics) for the "ugly" URLs. Indeed, they're not redirecting to the canonical locations any more.

Does anyone know of a plugin that has been shown to cause a problem like this? Could W3 Total Cache be contributing? I think I updated it sometime in the last few weeks; I was definitely tweaking the settings. (If it helps, my plugin list is published on this page.)

I'll debug manually when I have the time, but meanwhile I thought I'd give the #lazyweb a shot.

  • WordPress does not redirect a direct query to a pretty permalink out of the box as far as I've seen, there's no such feature, so you had to have some sort of plugin to do that for you. I went through the list and I couldn't find anything evident.
    – soulseekah
    Oct 17, 2011 at 4:21
  • I just noticed Redirection urbangiraffe.com/plugins/redirection as one of your plugins, and it appears to be capable of doing redirects maybe even according to the rewrite rules, that would be my first place to start looking into.
    – soulseekah
    Oct 17, 2011 at 4:32
  • Poked around in Redirection's options. Can't find an easy way to do it. I actually read in several other threads here that WP should automatically redirect to the canonical URL for the post or page in question. Something could be breaking it, though.
    – dgw
    Oct 17, 2011 at 5:14
  • dgw, please don't mix up canonicalization mattcutts.com/blog/seo-advice-url-canonicalization and WordPress pretty links and rewriting.
    – soulseekah
    Oct 17, 2011 at 9:14

1 Answer 1


Found the following in a plugin file using grep -Ri 'redirect_canonical' /path/to/wordpress/plugins:

remove_filter('template_redirect', 'redirect_canonical');

That disables WordPress' built-in canonical URL redirects. Disabling the component of the plugin that contained that line fixed the problem.

Beware the WordPress Mobile Pack's Mobile Switcher.

Hopefully reaching out to the plugin developer will result in a fix that allows both canonical redirects and mobile template switching. Otherwise I'll have to find another mobile plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.