WordPress permalinks affect the structure of the URLs on your website. For example, WordPress permalinks are the reason the URL for this blog post is https://wp-rocket.me/blog/wordpress-permalinks instead of something like https://wp-rocket.me/blog/?p=123.
In this post, you’ll learn more about the importance of WordPress permalinks. Then, we’ll show you how to change permalinks in WordPress, as well as some troubleshooting tips for common issues you might encounter with your WordPress permalinks not working properly.
Why You Should Care About Your WordPress Permalinks
Permalinks are important because they add some much-needed context to your content for both human visitors and search engine robots (like Google).
To illustrate this, let’s go back to the example from the introduction. If you saw this URL – https://wp-rocket.me/blog/?p=123 – would you have any idea what that page was about?
There’s no context, right? The only way to find out what the page is about is to actually click on the link and go there.
However, if you saw https://wp-rocket.me/blog/wordpress-permalinks, you’d at least have an idea that the post is about WordPress permalinks, right?
That’s important because:
- Human visitors can use that extra context to be more confident about visiting links to your site that they see on social media, forums, blog posts, etc.
- Search engines can use that extra context to help rank your content more highly for relevant search queries.
Additionally, some WordPress plugins – including WP Rocket – only work with custom WordPress permalinks. By “custom”, we just mean anything other than https://wp-rocket.me/blog/?p=123.
There’s one problem, though…
By default, a lot of WordPress sites use the contextless version. That is, they use something like https://wp-rocket.me/blog/?p=123 instead of actual words.
That means you’ll need to learn how to change permalinks in WordPress so that you can pick a better option…
How to Change Permalinks in WordPress (Structure and Slugs)
Note – if you’re working on an established WordPress site, you need to be careful about changing permalinks in WordPress. We’ll share some tips for how to do this safely at the end of this section – so read the whole way through before you make changes if your site is already receiving traffic.
There are two parts to your WordPress permalinks:
- Structure – this defines the overall template for your permalinks. For example, you can decide whether to include the date in your permalink structure.
- Slug – this is the unique text that appears inside that permalink structure for each post.
We’ll show you how to control both…
How to Change WordPress Permalink Structure
The process for how to change permalinks in WordPress is pretty painless. To get started, go to Settings → Permalinks in your WordPress dashboard.
There, you can use the radio boxes to select your desired permalink structure:
So what’s the best permalink structure for WordPress? For most sites, we recommend the Post name structure as it’s the simplest, clearest option. That’s what we use here at WP Rocket.
If the date provides important context for your content – like if you’re running a news site – you might want to use one of the options that includes the date in the URL, instead.
However, for most WordPress sites, Post name is definitely the way to go.
How to Change WordPress Slug for Individual Pieces of Content
Once you’ve chosen your WordPress permalink structure, you’ll further be able to adjust the slug for each piece of content.
You’ll make this choice when working in the regular WordPress editor for a post, page, or custom post type.
To set your slug, look for the Permalink option in the Document tab of the WordPress editor. If you’re using the Post name permalink structure, the text in the URL box is what will come after your main domain name, and you can see a preview of the final URL below that box:
How to Change WordPress Permalinks for an Established Site
If you have an established WordPress site where you’re already getting traffic, you need to be careful about changing your WordPress permalinks.
When you change your permalink structure, any links to your existing content will stop working because the URLs of your existing content will change.
That means you might miss out on traffic from social media, and it also means you might lose the SEO benefit of any links pointing to your old permalink structure.
To fix this, you can use a 301 redirect to redirect humans and search engine bots to the right spot when they visit one of your old links. If you want to switch to the Post name permalink structure, you can use this free tool from Yoast to generate the proper 301 redirect code.
WordPress Permalinks Not Working? Troubleshooting Common Issues
Most of the time, your WordPress permalinks function fine and you never need to think about them after you’ve set your permalinks.
However, sometimes things can go wrong, which can cause issues with your WordPress permalinks not working or a WordPress permalink producing a 404 error.
If that’s happening to your site, usually you can fix the issue by regenerating your site’s .htaccess file.
See, when you set up your WordPress permalinks, WordPress adds those rules to the .htaccess file on your server. If something goes wrong with that file, it might cause issues with your WordPress permalinks.
Thankfully, it’s easy to force WordPress to generate a new .htaccess file.
To do that, just go back to the Settings → Permalinks area and click Save Changes. Yup – no need to make any changes – just click the button to save changes:
That should fix the issue.
Recap: WordPress Permalinks 101
To sum up, your WordPress site’s URLs are comprised of two key components:
- Permalink structure – this sets the overall URL template for your site.
- Slug – this is the actual text that appears in your URL. You set it on a page-by-page basis.
For most sites, we recommend the Post name permalink structure, which you can set by going to Settings → Permalinks.
Additionally, WP Rocket requires that you use a custom permalink structure – like post name – in order to function.
Once you’ve set your permalink structure, you can edit the URL slug for each post or page from the WordPress editor.
Finally, if you run into any issues with your WordPress permalinks not working, the most common fix is to force WordPress to generate a new .htaccess file by clicking Save Changes in the Settings → Permalinks area.