A Simple Guide to Changing Your Permalinks Without Breaking Your WordPress Website
What Are Permalinks?
Permalinks are the part of the web address that comes after your domain name and point to specific posts and pages on your site. When set correctly they serve several purposes.
- They allow your readers to get a brief understanding of what your post or page is about without looking at the content.
- They are used by search engines to discover the post or page topic solely from the URL.
- They also supply a permanent location for your visitors and search engines to return to in order to read your content.
- They are essentially a unique identifier for each piece of content you create.
You set the permalink structure in WordPress from the Settings > Permalinks menu on the dashboard. By default WordPress is set to use the database ID number of each post as the permalink. This is quite an ugly structure and does a terrible job of telling you anything about the content.
Most people will change the default permalink structure of their WordPress blog at its creation. There are several options to choose from, but the most common two choices are the structure that shows the date followed by the post name or simply the post name on its own. This choice is usually made with the intended content in mind. For example, websites that focus on news items tend to have the date as part of the permalink structure.
You would think that since it is easy to change the permalink structure at the creation of a website it should also be a simple process for an established website. While the act of making the change is as simple as selecting a new permalink type and clicking save, the consequences of that action require a little more discussion.
Why Would I Change My Permalink Structure?
There are several reasons why you would consider changing your permalink structure, especially if you have been using the default setting. If you have been using the default option you will become aware that it is practically useless from an SEO standpoint and you want a structure that is far better. You could also be changing the direction of your site and now require it to have the date in some manner as part of the structure. There are many reasons and all of them specific to your requirements and situation.
How To Safely Change The Permalink Structure
If you’ve decided that you have to change your permalink structure, you’ll need to do a few things. The first decision you need to make is the syntax of your new permalink structure. Do you need to include the date? How do you want that to display if you do? Do you plan on using the day or just the month or year as part of your structure?
It is an important decision and you shouldn’t make any changes at all until you have made absolutely sure of your choice. There is a very useful guide to using permalinks in the WordPress codex that can give you ideas for your new structure.
Once you know which syntax you are going to use, it is time to go into the Permalinks menu of your dashboard and make the change. This will now update all of your internal URLs with the new syntax. All of the internal links should update correctly if they have been added as part of WordPress. Any manual links may need to be updated. However, all links to your site from elsewhere will now be completely broken and all the content indexed by search engines will be incorrect.
Fixing External Links With 301 Redirects
There is a simple solution to this problem and that is to setup 301 redirects on your website. A 301 redirect essentially tells any browser that comes to your site using an old permalink structured URL where the relevant content is. It also lets search engines know that this is a permanent change.
In the past you would have been required to add all of these redirects manually to your.htaccess file on your web server. Thankfully, with WordPress there are plugins that can take care of all of these things for you. To easily create the redirects on your WordPress website I recommend the Simple 301 Redirects plugin.
Using the Simple 301 Redirects Plugin
You can download the plugin from the WordPress.org repository here. Once you have installed and activated the plugin it adds a new menu to the Settings area of your dashboard.
There really isn’t a great deal to worry about with this plugin. In the 301 Redirects settings window you are shown two simple fields. One is labeled Request and the other Destination. This is basically where you enter the old permalink structure and the new permalink structure. You only need to add the information after your domain name to these fields.
In the example in the image above, the Request field is the WordPress configuration for the Month and Name permalinks while the Destination field is the WordPress configuration for the Post name permalink structure. Once you have added these two fields, save the changes. This will now tell any search engine traffic that comes into the old links where to go.
Using the Yoast SEO Permalink Helper Tool (to redirect to /&postname%/)
Yoast SEO has a very handy tool that will allow you to simply select your current permalink structure and then it generates the code you need to manually add to your site’s .htaccess file to redirect all the posts safely to the new /%postname%/ structure. Of course this is a very handy tool but it only gives you the code to redirect the the postname structure while the plugin recommended above can be used to redirect multiple cases to various destinations.
Changing Search Engine Links to the New Structure
This unfortunately is beyond your control. The next time any search engines crawl your site, which happens on a regular basis, these links will be updated. If you have an XML sitemap on your website (and you really should) it is possible to aid this process by manually re-indexing it.
Changing the permalink structure of your website is something that should be considered and planned before you do anything.
While making the change and limiting the problems has never been easier, you may still take an SEO hit to your site. That may be fine in the short term if you are changing to a more SEO friendly permalink structure, but it isn’t something you want to have to continually deal with. Pick your new permalink structure and stick with it.
The Simple 301 Redirects plugin should remove most of the problems you will face but it isn’t supposed to replace good planning and consistency of structure on your website. You may still have the odd broken link 404 error, so it may be worth thinking about creating a custom 404 page with information about the permalink change. That topic is for a whole other post though.
Have you undertaken the permalink change in the past? Did you experience any problems with search engine traffic and broken links? How did you resolve them? We’d love to hear about your experiences doing this in the comments below.