By default, WordPress uses URLs like this http://example.com/?p=123. This URL structure is not SEO friendly. This is why most WordPress site owners use Pretty Permalinks, which is a term used for SEO friendly URLs in WordPress. These SEO friendly Permalinks contain post, category, tag, title in the URL, allowing you to use Keywords inside your URLs. In this article, I am going to show you how to set up Permalinks in WordPress and make your website more SEO friendly.
To set up Permalinks on your WordPress site, simply go to Settings » Permalinks. There you will see a number of options to choose from:
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.
- %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. syed-balkhi.
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. All our recommended WordPress hosting providers have set up their servers with necessary configuration to run WordPress. This means your server should already be configure to use Apache’s mod_rewrite module.
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.
I hope this article helped you set up Permalinks in WordPress. It will certainly provide the SEO boost your site deserves.
About Noumaan Yaqoob
Noumaan is a professional blogger and a WordPress developer. He likes Star Trek, Quora, and Debian.