Changing WordPress Permalink Settings: Inconsistencies and Gotchas
Today’s article starts with a sad WordPress story, then explains why the sad story happened and what you can do to avoid it.
There’s also a video, which demonstrates inconsistencies in the way WordPress’s permalinks structures change—these inconsistencies caused the problem that the sad story describes. If you’re into watching things, you should start there!
A Sad Story about WordPress Permalinks
The sad story is indeed about WordPress permalinks. It’s a true story: it happened to me earlier this month. It goes like this:
- I volunteer with an organization that, among other things, helps young people fundraise on their own behalf for enriching personal travel. We’re handling this in WordPress (with the excellent Give plugin).
- Another person in the organization shared one young person’s fundraiser on Facebook. It went semi-viral, accumulating 100 or so likes.
- At around this time, I made some changes to the site’s permalink structure. Each fundraiser is of post type Post, and in my experience Posts have generally forwarded themselves through permalink changes.
- For this change, though, the forwarding didn’t work. The hundreds of clickthroughs from the Facebook post all went to a 404 page, and I began getting emails with subjects like “Urgent!!!” and text content like “I’m concerned that we’re throwing money away.”
- I manually 301ed that, and every, post on the site, and the problem subsided—but not before a lot of apologetic reposting on Facebook and an unknown number of lost donations.
WordPress’s default permalink rewriting behavior is very strangely inconsistent.
So how did this happen?
It happened because, as it turns out: WordPress’s default permalink rewriting behavior is very strangely inconsistent.
In other words, let’s say I change
mysite.com/my-post, but I’ve still got a Facebook post linking to
mysite.com/post. What happens when you click the Facebook post?
The answer is: It’s very hard to predict. WordPress forwards rewritten URLs some of the time, depending on the nature of the rewrite—but not all the time, and the rules separating the conditions (as we’ll see) don’t make much sense. In fact, WordPress’s forwarding behavior is just enough, in my experience, to make you relax into a potential disaster.
Why it Matters When Permalinks Don’t Forward Properly
Defining “Forward Properly”
To keep this simple, and also to draw from my specific experience, we’ll use a very practical definition. A WordPress URL is forwarding properly if the following sequence can occur:
- Someone shares the original URL on Facebook
- The URL changes
- People who click on the Facebook post, after the URL change, still see the resource that was linked to on Facebook (and not a 404 page, homepage redirection, or anything else)
If your URL changes don’t meet this test, then people, and search engines, are failing to find your content.
If your URL changes don’t meet this test, then people are looking for, and failing to find, your content. And, to state the hopefully obvious, the “people” who are failing to find your content can also include search engine crawlers, heavily damaging your site’s SEO profile.
In other words, if you change your URLs, the change fails the above test, and you don’t do something about it, then like me on my site…
Testing WordPress Permalink Forwarding
After my uncomfortable surprise, I tested the way Permalinks work on two independent setups:
- A local WordPress install on WAMP, and
- A live site on SiteGround shared hosting
Apart from the need to clear the SiteGround site’s caching after every permalink change, both environments behaved similarly. Let’s look at which types of permalink changes do and don’t appear to “forward properly,” given the definition above.
Permalink Changes that Appear to Forward Properly
Renaming Individual Post URLs
For example, if you change
wpshout.com/permalink-article, using the URL editor in the post editing screen, the URL will forward along properly. If you then visit
wpshout.com/permalinks, you’ll still end up at
This appears to be true by default for posts of any post type, including Post, Page, or a custom post type.
Some Changes to Permalink Settings
Permalink settings define your site’s general schema for how permalinks will be written.
Changing these settings leads to the most unpredictable results in terms of URL forwarding. However, some changes do seem to consistently forward properly:
- Switching between “Day and name” and “Month and name” seems to work, in any direction.
- It appears to be possible to switch to “Numeric,” and to switch from “Post name,” without problem, although the opposite is not true (see below).
Permalink Changes that Appear Not to Forward Properly
Some Changes to Permalink Settings
The following permalink setting changes do not appear to forward affected URLs:
- Switching to “Post name” from any other permalink structure, except “Plain” (in other words, if you’re switching to “Post name,” it’ll only forward properly if you’re switching from “Plain”)
- Switching from “Numeric” to any other permalink structure
- Switching to “Plain” from any other permalink structure
Specifics on Switching to “Plain”
Switching to “Plain” actually leads to two different behaviors on the two sites I tested, neither of which is what I would expect. On my WAMP install, it creates a server error:
On the live site, switching to “Plain” doesn’t attempt to forward at all. The old URL simply delivers traffic to the site’s homepage, which is the default behavior on that site for 404ing pages.
In other words,
http://validcognition.com/2015/03/on-spirituality-and-cool/ should forward to
http://validcognition.com/?p=1558, but instead simply 404s, exactly as would
Video Summary of Inconsistencies
The following video demonstrates these behaviors:
What to Do About This
Especially if you’ve watched the video, you should have a good sense that WordPress’s permalink forwarding behaves very oddly and unreliably. So what can you do to prevent stories like the one that started this article? A couple of things:
Double- and Triplecheck Any Permalink Forwarding You Think WordPress May Be Doing
If you change permalink structures, go crazy checking that the old permalinks still forward. Check this for different post types, and for multiple posts.
Forward URLs Yourself
A number of WordPress plugins make it quite easy to create manual 301 redirect rules for forwarding URLs—rules that forceone URL to permanently point to another. The plugin I’ve mostly tried and liked for this is called Simple 301 Redirects.
Obviously, if you’re trying to forward, say, 2,000 blog posts, this approach is likely to be impractical. But if you’re really concerned about a couple of special of pieces of content (like the fundraiser post that was going viral on my site), backing up WordPress’s default behavior with manually written permalinks makes a lot of sense.
As a last note, I’ve checked a lot through the support threads on this topic, and they all recommend one or another
.htaccess hack. I wouldn’t rely on that, since WordPress is displaying the same inconsistent behavior in two well-configured, and quite different, hosting environments. However, if I am missing something and an
.htaccess hack can solve all this, let me know and I’ll be delighted to write a follow-up article!
Be Careful Out There!
WordPress’s permalink forwarding is a wild and woolly animal, and one which gave me a minor trampling last week. Please be careful with WordPress permalinks—and, in general, don’t always assume that you know what you think you know.
What’s your experience with WordPress permalink changes? We’d love to hear your questions and thoughts in the comments below!