Creating SEO-friendly URLs is a super simple way to improve your SEO. If you get it right, you’ll improve your organic search visibility, especially for low-volume long-tail keywords. Google, and visitors, love URLs that make sense. While some feel including long tail URLs with the entire post name is good, studies suggest shorter URLs perform better overall.
As you may already know every page and post in WordPress has a unique URL which is used to access and read the contents of that post. The other fancy name for a URL is permalink which means permanent link because the URL once given to a post should remain permanent.
Visitors can bookmark permalinks for later use, share on their social profiles and link to them from their own content.
What are WordPress permalinks?
WordPress permalinks by default are a bunch of numbers and dashes also known as ugly URLs. If you make a post in WordPress and see it’s URL, it will be like, for example
http://example.com/?p=123
From where that p=123 comes from is basically the post ID number in your WordPress database wp_posts table.
WordPress will keep on increment these numbers for the posts you make. Although this functionality assures there will be no two posts with the same URL but the default URL structure lacks human readability and other issues discussed in next section.
Why change permalinks in WordPress?
The default permalink structure in WordPress is neither user-friendly nor SEO friendly and that’s why you should change it.
Which one of the following two URLs make more sense to you?
http://example.com/?p=123 or http://example.com/wordpress-themes
The latter one is also called a pretty link which is certainly more obvious giving more clues about the article’s content. It will get more shares results in more traffic.
The keywords in the pretty permalink will make it even more SEO friendly and make search engines job easier to crawl and index your pages.
The Permalink Settings Page Explained
Now you know why pretty permalinks are important, it’s time to change WordPress ugly URLs to pretty permalinks.
- From your WordPress dashboard, go to Settings > Permalinks.
- Plain
https://www.example.com/?p=123 - Day and name
https://www.example.com/2016/01/22/sample-post/ - Month and name
https://www.example.com/2016/01/sample-post/ - Numeric
https://www.example.com/archives/123 - Post name
https://www.example.com/sample-post/ - Custom Structure
Choose your own URL structure using available tags.
Choosing a Permalink Structure
Most WordPress SEO experts agree that the best permalink structure is the one that uses the post name in the URL. The default options allow you to choose from day and name, month and name, and post name URL structure. There is also an option to have numeric permalinks. Numeric permalinks are better than the ugly URLs but they are not considered as good as the URLs with post name.
You need to choose one of the default options by clicking the radio button next to it and save your settings.
Apart from the default options, you can also create your own Permalink structure using special tags. The available tags that you can use are:
- %year% – Four digit year of post, e.g. 2014.
- %monthnum% – Two digit month of post, e.g 07.
- %day% – Two digit day of the mont, e.g. 18.
- %hour%
- %minute%
- %second%
- %post_id% – The unique ID number of the post example, 123.
- %postname% – The title of the post sanitized to be used in post URL, e.g. how-to-set-up-permalinks-in-wordpress
- %category% – Category name sanitized to be used in URL. e.g. wordpress-tutorials.
- %author% – Author name sanitized to be used in URL. e.g. themeinwp-staff.
WordPress allows you to use whatever structure you want. However, you are required to use %postname% and %post_id% for your individual post. These tags are unique identifier that help WordPress locate the post from the database. Same goes for your category archives. They must have %category% in them.
We recommend reviewing which permalink structure you prefer before you start publishing content. Note that if you change your permalink structure at a later date, your post and page URL’s will also change. Therefore if you change your permalink structure in the future, you will need to set up 301 redirect in your .htaccess file in order to redirect users to proper content.
Troubleshooting User-Friendly Permalink Structure
In rare cases, your server may not have this module enabled. In that case you will see a notice in your Permalink settings page informing you that WordPress cannot write to the .htaccess file.
WordPress Permalinks need mod_rewrite module installed on your web server. WordPress also uses a special server configuration file called .htaccess to use pretty permalinks.
The two most common causes for permalinks not working are:
1. Incorrect File Permissions
In correct file permissions stop WordPress from creating or writing to the .htaccess file. To solve this issue you would need to connect to your website using an FTP client. Make sure your FTP client is set to show hidden files. You will see a .htaccess file in your website’s root directory. If you do not see it, then you need to create one. After that simply copy and paste the rewrite code shown in Permalinks settings into your .htaccess file and save it.
2. mod_rewrite Module is Not Available on Your Server
For permalinks to work, you need mod_rewrite module enabled on your webserver. If they are not then you need to contact your hosting service provider and ask them to enable it for you.
We hope this article helped you set up Permalinks in WordPress. It will certainly provide the SEO boost your site deserves.