Permalinks play a vital role in informing visitors and search engines about the content of your webpage. This provides you with SEO benefits while improving the user experience for your visitors.
In this knowledgebase article, we will show you how to correctly configure your permalink structure in WordPress and automatically redirect old permalinks to new ones using Rank Math.
Table of Contents
- What are Permalinks?
- Why Do Permalinks Matter?
- How to Change the Permalink Structure in WordPress?
- Custom Permalinks in WordPress
- Tags in the Permalink Settings
- Rank Math’s Strip Category Base Option
- Rank Math’s WooCommerce Permalink Features
- WordPress URL Redirection
- Auto Post Redirect By Rank Math
1 What are Permalinks?
A permalink is simply the hyperlink used to direct people to a specific webpage. It’s considered permanent because it generally shouldn’t change as this can break existing links to the corresponding page (however, in practice, changing permalinks can have huge SEO benefits).
For example, our homepage is located at https://rankmath.com/, our blog is at https://rankmath.com/blog/, and a single post follows the ideal permalink structure: https://rankmath.com/blog/schema-markup/
Not only this, but Permalinks are also used for archive pages, static pages, and any content on your site that needs its own URL.
Permalinks comprise your site’s domain name as well as a slug, and it’s extremely important to make sure that your permalinks are SEO as well as user-friendly.
2 Why Do Permalinks Matter?
Permalinks play an important role, and it has an impact on SEO, user experience as well as branding.
2.1 Search Engine Optimization
The most beneficial use of permalinks is SEO. Permalinks help to boost the page rankings on the search engine results pages (SERPs) as it informs the search engines what posts and pages are all about.
It also helps search engines to index the posts/pages better for the relevant keywords. For example, if your post contains information about desserts and chocolates, your post will be something like this: https://www.test.com/desserts-chocolates.
2.2 Good Site Architecture
Organizing your website is important as it provides high-quality UX for website visitors. Permalinks help to organize your website’s structure and lead to better user engagement.
With the help of Permalinks, users can easily understand how the content is organized on the website, making it simpler for them to sink in the information on the subjects they’re reading about.
3 How to Change the Permalink Structure in WordPress?
WordPress comes with a default permalink structure that includes ?=123
, which includes the post ID to identify the post. However, this structure isn’t helpful in terms of SEO, and you should consider changing them. The following steps will walk you through the process of changing the permalink structure.
3.1 Navigate to Permalinks in WordPress
In order to change the permalinks, go to WordPress Settings → Permalinks
3.2 Select the Permalink Structure
In this, you can choose from the variety of structures that are available:
By default, Plain structure is used by WordPress. However, this is not the best option suitable for your SEO. You can select a different setting and then save your changes.
You can also create custom permalinks in WordPress. Let’s have a close look at how you can achieve this.
4 Custom Permalinks in WordPress
Custom Permalinks are useful when you want to assign a custom path to individual posts, pages, tags, or categories. Following are the ways to create custom permalinks:
4.1 Change Your Site’s Permalink Structure
You can change your website’s permalink structure in WordPress. In order to do so, go to Settings → Permalinks. Click on the radio button next to the Custom Structure.
You can select from the available tags (we’d cover them shortly) and then click on Save Changes. Once it is saved, all posts on your WordPress website will follow this new structure.
4.2 Change the URL Slug for an Individual Post/Page
You can also change the slug for an individual post/page in WordPress. To do so, edit a post that you want to change the slug for.
In the Classic Editor, you will find the permalink just below your post. Click on Edit and then change the end of the URL.
In Gutenberg, you will find the URL slug in the Article → Permalink section.
You can type your desired slug in the URL Slug to either make it shorter or more focused. Once done, click the Publish or Update button to save your changes.
4.3 Edit Snippet Using Rank Math
You can edit Permalink using the Snippet Editor of Rank Math. If you’re using Classic Editor, then you need to scroll down a bit to get to Rank Math’s Meta Box. But if you’re using the Block Editor, Meta Box can be accessed by clicking the Rank Math SEO icon on the top-right corner of the page.
It will open the metabox where you have the option to edit the snippet.
For editing the snippet, click Edit Snippet as shown below.
In the Preview Snippet Editor, under the General tab, you can see how your SERP would look when someone searches for the keyword. From here, you can also edit the Permalink. Rank Math also includes a length indicator to give you an idea of the length of the full URL. We recommend keeping it below 75 characters.
5 Tags in the Permalink Settings
WordPress includes ten permalink structure tags you can use to create unique permalinks. Now let us look at the tags available in the permalink settings.
5.1 Year
The %year%
tag will add the year of the post in 4 digits, for example, 2022.
5.2 Month Num
The %monthnum%
tag will add the month of the year in 2 digits, for example, 02.
5.3 Day
The %day%
will add the publication day of the month, for example, 14.
5.4 Hour
The %hour%
will add the hour of the day, for example, 12.
5.5 Minute
The %minute%
tag will add the minute of the hour in 2 digits, for example, 40.
5.6 Second
The %second%
tag will add the second of the minute in 2 digits, for example, 15.
5.7 Post Id
The %post_id%
tag will add the unique ID of the post, example 342.
5.8 Post Name
The %post_name%
tag will add the post-name slug, example “My Best Post” will be “my-best-post”.
5.9 Category
The %category%
tag will add the entire categories slug from the Posts → Categories section.
5.10 Author
The %author%
tag will add the author name slug from the Users → Profile section.
6 Rank Math’s Strip Category Base Option
If you want shorter URLs, you can enable the strip category base option from Rank Math SEO → General Settings → Links section, as shown below. If this option isn’t available for you, make sure you’re using the Advanced mode of Rank Math.
The Strip Category Base option will discard the category names from the category archive URLs. This will result in cleaner URLs and redirect them without causing any errors.
7 Rank Math’s WooCommerce Permalink Features
Rank Math allows you to choose a permalink structure for your WooCommerce products. You can find the permalink settings by navigating to Rank Math SEO → General Settings → WooCommerce, as shown below.
Let us look at each setting in detail:
7.1 Remove base
You can remove the unnecessary prefixes, such as shop and product, from your URLs by enabling the Remove base option.
7.2 Remove category base
By default, WooCommerce adds /product-category/
before the actual category appears in your permalink, which is not suitable in most cases. By enabling the remove category base option, the /product-category/
will be removed from the permalink.
So if your permalink is yoursitename.com/product-category/category-name
, after enabling the remove category base option, the permalink will look like: yoursitename.com/category-name
which is easier to read.
7.3 Remove parent slugs
The parent category slug will be removed from your product page permalinks when the Remove parent slugs option is enabled.
8 WordPress URL Redirection
As we’ve seen that Permalinks aren’t meant to be changed, but it’s also not possible to have the same web page URL. But you need not worry as URL redirections come to your rescue in this scenario.
WordPress has the feature to create auto-post redirects whenever you change the slugs of posts. But this is only applicable to posts. You cannot create redirects for pages, taxonomies, or CPTs.
9 Auto Post Redirect By Rank Math
URL Redirection makes sure that any number of attempts to locate an old URL is redirected to the new address. Rank Math makes it very easy for you to set up redirections and automatically drive the users to the new URL. This ensures that there is no loss of website traffic due to a broken link.
By using Rank Math, you can even create redirects for all posts, pages, taxonomies, and CPTs when compared to WordPress URL Redirection.
If you still have any questions about Permalinks or facing any issues with permalinks – you’re always more than welcome to contact our dedicated support team. They’re available 24/7, 365 days a year.