WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 '11 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 '11 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 '11 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 '11 at 9:14
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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