A Guide To WordPress Permalinks, And Why You Should Never Use The Default Settings
The URLs of the content you publish on your WordPress website are known as permalinks. Permalinks are what people enter into their browser address bar to view one of your pages. They are also what search engines and other websites use to link to your website. Due to this, they are very important.
You can change the structure of your permalinks at any time, however doing this changes the URL of your pages. This can cause your search engine traffic and referral traffic to drop considerably as visitors are presented with 404 page errors instead of the page they wanted to view.
301 redirects can stop the impact of a change in permalink structure, however it is still better to configure your website with the permalink structure you want from the beginning.
In this article, I would like to show you what permalink structures are open to you and explain the benefits of using clean URLs on your website.
The Default Permalink Structure
WordPress permalink settings can be found in the main settings menu of the WordPress admin area (i.e. http://www.yourwebsite.com/wp-admin/options-permalink.php).
In the screenshot below, you can see the five custom permalink structures that WordPress displays as common settings.
WordPress automatically enables the default permalink structure after you install WordPress. The number that is used in the default permalink advises WordPress where the content can be found in your database. To be more specific, the number refers to the ID of the table row in the wp_posts table of your WordPress database (the table prefix for your website will be different if you changed it during the installation process). For example, http://www.yourwebsite.com/?p=50 would refer to the 50th row in your website’s wp_posts table and http://www.yourwebsite.com/?page_id=100 would refer to the 100th.
The default permalink structure is not user-friendly. It is better to refer a visitor to a URL such as http://www.yourwebsite.com/big-news-story/ than http://www.yourwebsite.com/?page_id=54367.
The part at the end of the permalink, i.e. ?p=123, is known as a query string. The question mark is a separator and the part that follows afterwards is the identifying data. In this case, we are identifying content from a specific row in our WordPress website.
Despite many people suggesting otherwise, search engines such as Google can index URL’s that contain query strings (billions of indexed pages online are testament to this). However, search engines do prefer you to use “friendlier” URLs.
In their Search Engine Optimization Starter Guide, Google make it clear that a structured URL structure with keywords will make it easier for them to crawl your pages:
Creating descriptive categories and filenames for the documents on your website can not only help you keep your site better organized, but it could also lead to better crawling of your documents by search engines. Also, it can create easier, “friendlier” URLs for those that want to link to your content.
Visitors may be intimidated by extremely long and cryptic URLs that contain few recognizable words. URLs like (1) can be confusing and unfriendly. Users would have a hard time reciting the URL from memory or creating a link to it. Also, users may believe that a portion of the URL is unnecessary, especially
if the URL shows many unrecognizable parameters. They might leave off a part, breaking the link.Some users might link to your page using the URL of that page as the anchor text. If your URL contains relevant words, this provides users and search engines with more information about the page than an ID or oddly named parameter would.
So to summarise Google’s points above :
- URLs with a structured hierarchy will make it easier for them to crawl your pages
- Visitors may cut off part of your URL when copying a link as the additional code might seem unnecessary
- URLs that contain relevant keywords will help you rank better in search engines
Due to these reasons, it is better to use one a more search engine friendly permalink structure on your WordPress website.
A Search Engine Friendly Permalink Structure
Apart from the default permalink structure, all of the permalink structures that WordPress offers are search engine friendly (though %post_id% does not utilize keywords). These permalink structures are sometimes referred to as “Pretty Permalinks” or “Clean URLs”.
In order to use these permalink structures, WordPress needs to modify your website’s .htaccess file. WordPress might be able to do this automatically for you. If it cannot, you need to add the code to your .htaccess file manually.
You can find a guide on how to do this on WordPress.org. If you find that guide difficult to follow, I recommend speaking to your web hosting company about this issue. They will be able to add the necessary code to your .htaccess file or make your .htaccess file writable so that WordPress can automatically change your permalink structure.
When you choose one of the five common permalink structures that WordPress suggests, you will see the custom structure field change. The different tags that you see listed in this field are known as structure tags. There are ten structure tags available to you.
- %postname% – The post slug of your post
- %post_id% – The unique ID of a post
- %category% – The category a post was assigned to
- %year% – The year the article was published
- %monthnum% – The month the article was published
- %day% – The day the article was published
You can also use the following tags (though very few websites do):
- %hour% – The hour the article was published
- %minute% – The minute the article was published
- %second% – The second the article was published
- %author% – The author name
Pretty permalink structures need to include either the post name (%postname%) or the post ID (%post_id%). The post slug refers to the last part of your permalink. It can be edited directly through the post editor.
Technically, you could use a permalink structure such as month and name without using %postname% or %post_id% (i.e. /%year%/%monthnum%/). This would only function correctly if you published one article per month. If two articles were published in a given month, they would both have the same URL. The result is that all articles from that month would be published on the same URL, therefore you would be unable to actually view any post on its own.
In other words, you need to use either %postname% or %post_id% to ensure that the URLs of posts and pages are unique.
What is the Best WordPress Permalink Structure?
The ten permalink structure tags that are available theoretically allow you to create a large number of unique permalink structures. In practice, most WordPress websites use of the following permalink structures:
- Post Name (/%postname%/ -> www.yourwebsite.com/big-news/) – Post name is very popular with WordPress owners because it generates short memorable URLs. I use it on my personal blog. It is not suitable for websites that publish multiple times per day as it will become very difficult to come up with unique post slugs. For example, a tech blog might use the post slug /iphone-6-news/ for their first iPhone 6 news story; however they could not use that post slug ever again.
- Category and Name (/%category%/%postname%/ -> www.yourwebsite.com/sports/big-news/) – Category and name is the permalink structure that the Elegant Themes blog uses. It creates a hierarchical structure of content on your website and ensures that visitors know what category they are viewing. It also stuffs the most keywords into your URL than any other option; which (apparently) is great from an SEO point of view.
- Day and Name (/%year%/%monthnum%/%day%/%postname%/ -> www.yourwebsite.com/2014/05/01/big-news/) – High traffic news websites can publish dozens of articles per day. That is why most websites with a high posting frequency use the day and name permalink structure. It ensures their page URLs contain the year, month, and day, that an article was published.
- Month and Name (/%year%/%monthnum%/%postname%/ -> www.yourwebsite.com/2014/05/big-news/) – Month and name is another popular choice. It generates URLs that are two characters shorter than day and name.
The post name and category and name permalink structures are also popular because they do not specify the date an article was published within the URL. This is preferable if the content on your website will still be relevant for many years e.g. a history website. I have, however, seen a lot of website owners take advantage of this and completely remove the publication date from their articles; which can be frustrating as a reader as you do not know whether the information on the page is still valid.
In my experience, the four permalink structures mentioned above are the most common online. Does that mean they are the best?
If you search for “best WordPress permalink structure” online, you will find many people stating that post name is the best permalink structure for WordPress. Few people actually back up this view with facts. With many bloggers, it appears to merely be their own personal preference.
A few years ago, the post name permalink structure was actually known for affecting the performance of a WordPress website. It was still used by many WordPress users, despite it not being an option in the permalink settings page. Thankfully, this performance issue was addressed in WordPress 3.3 in 2011.
From an SEO point of view, I have seen nothing to suggest that any of the options mentioned previously have an advantage over the others. If one permalink structure was better for SEO, everyone would be using it.
This suggests that the key concern is performance.
What is the Best WordPress Permalink Structure?
The ten permalink structure tags that are available theoretically allow you to create a large number of unique permalink structures. In practice, most WordPress websites use of the following permalink structures:
- Post Name (/%postname%/ -> www.yourwebsite.com/big-news/) – Post name is very popular with WordPress owners because it generates short memorable URLs. I use it on my personal blog. It is not suitable for websites that publish multiple times per day as it will become very difficult to come up with unique post slugs. For example, a tech blog might use the post slug /iphone-6-news/ for their first iPhone 6 news story; however they could not use that post slug ever again.
- Category and Name (/%category%/%postname%/ -> www.yourwebsite.com/sports/big-news/) – Category and name is the permalink structure that the Elegant Themes blog uses. It creates a hierarchical structure of content on your website and ensures that visitors know what category they are viewing. It also stuffs the most keywords into your URL than any other option; which (apparently) is great from an SEO point of view.
- Day and Name (/%year%/%monthnum%/%day%/%postname%/ -> www.yourwebsite.com/2014/05/01/big-news/) – High traffic news websites can publish dozens of articles per day. That is why most websites with a high posting frequency use the day and name permalink structure. It ensures their page URLs contain the year, month, and day, that an article was published.
- Month and Name (/%year%/%monthnum%/%postname%/ -> www.yourwebsite.com/2014/05/big-news/) – Month and name is another popular choice. It generates URLs that are two characters shorter than day and name.
The post name and category and name permalink structures are also popular because they do not specify the date an article was published within the URL. This is preferable if the content on your website will still be relevant for many years e.g. a history website. I have, however, seen a lot of website owners take advantage of this and completely remove the publication date from their articles; which can be frustrating as a reader as you do not know whether the information on the page is still valid.
In my experience, the four permalink structures mentioned above are the most common online. Does that mean they are the best?
If you search for “best WordPress permalink structure” online, you will find many people stating that post name is the best permalink structure for WordPress. Few people actually back up this view with facts. With many bloggers, it appears to merely be their own personal preference.
A few years ago, the post name permalink structure was actually known for affecting the performance of a WordPress website. It was still used by many WordPress users, despite it not being an option in the permalink settings page. Thankfully, this performance issue was addressed in WordPress 3.3 in 2011.
From an SEO point of view, I have seen nothing to suggest that any of the options mentioned previously have an advantage over the others. If one permalink structure was better for SEO, everyone would be using it.
This suggests that the key concern is performance.
I wrote an article about the best WordPress permalink structure four years ago and wrote a follow up article a year later.
My first article referred to an article on Weberz from 2009 that stated that many SEO experts give wrong advice regarding WordPress permalinks. Back then, with the issue with post name still causing performance issues, many people recommended started your permalink structure with a numeric field such as the year or post ID. However, people who were involved with optimizing search engines stressed that any performance issues were negligible anyway, therefore it made more sense to use a permalink structure that was better for SEO.
Five years later, and with the post name performance issue long behind us, there seems to be no performance issues linked with any common permalink structures. And to my knowledge, there is no SEO benefit of using one permalink over another.
What WordPress Permalink Structure to Use?
I would recommend using the day and name option (/%year%/%monthnum%/%day%/%postname%/) if you have a news website that publishes multiple articles per day. It is what top blogs such as Engadget and Mashable use.
For everything else, I would use post name (/%postname%/) or category and name (/%category%/%postname%/).
I use post name myself with all of my websites. I am not an SEO expert, though the idea that inserting categories into your post URLs to boost rankings seems plausible, as it allows you to define more keywords in the URL.
Categories are not something I like to attach to a URL as it restricts you from ever modifying your categories. I have changed the names of my post categories two or three times over the last few years. If I had been using category and name as my permalink structure, all of my URLs would have been broken. I therefore prefer not to include category in permalinks as it gives me the option of moving posts to a different category or renaming a category at a later date.
The Category and Tag Base
At the bottom of the permalink settings page you will see optional settings for your category base and tag base. The default values for these fields are category and tag.
With the default settings, if you have a category on your website called WordPress, the URL of the WordPress category archives would be http://www.yourwebsite.com/category/wordpress/. Likewise, if you have a tag called Themes, the tag archive URL for that tag would be http://www.yourwebsite.com/tag/themes/.
Changing these fields allows you to change the URLs that are used for archives. For example, you could change the category base to cat and the tag base to topic. In our example, this would generate the archive URLs http://www.yourwebsite.com/cat/wordpress/ and http://www.yourwebsite.com/topic/themes/.
Many website owners like to remove the category base so that their category archive URL looks cleaner. In the example given above, if you stripped the category base, the category archive URL would change from http://www.yourwebsite.com/category/wordpress/ to http://www.yourwebsite.com/wordpress/.
For many years, the plugin WordPress SEO allowed you to remove the category base; however an update of WordPress SEO in March this year removed this functionality (apparently it was buggy).
An old plugin called FV Top Level Categories is available that strips the category base. I am always reluctant to use plugins that have not been updated for years, however Joe Foley from WPMU recently published a solution that strips the category base without modifying any code or installing any plugin.
All you have to do is enter /%category%/%postname%/ as your custom permalink structure and a period (full stop) for the category base.
I tried this configuration on my test blog and it automatically removes the category base from URLs. Note that you cannot simply add a period for your category base. You need to include %category% in your permalink structure. Failure to do this will create 404 page errors for your categories.
Final Thoughts
Your permalink structure dictates how your website URLs are constructed. As such, it is something that you should review before you launch your website.
From an SEO and performance point of view, there does not seem to be any major benefits to choosing one permalink structure over another. Therefore, it really comes down to your own preference.
Remember, it is in your best interest to keep the same permalink structure once your website has launched. If you do decide to change, use Yoast’s 301 redirection script or a redirection plugin such as Redirection to ensure that you do not lose any traffic.
Should you have any questions regarding WordPress permalinks, please leave a comment and I will do my best to answer them.
Picture Credit @kinsta