ThemeLab's Blog

Stay up to date with our newest WordPress themes, WordPress plugins, WordPress tutorials, and other announcements.

How to Set up Pretty Permalinks in WordPress

Last Updated on by

How to Set up Permalinks in WordPress

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:

Permalink settings in WordPress

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. 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.

Update .htaccess Now

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.

If you liked this article, then join ThemeLab on Twitter and Google+.

About

Noumaan is a professional blogger and a WordPress developer. He likes Star Trek, Quora, and Debian.

  • http://www.beautifulsummermorning.com Nick Grimshawe

    Thanks for the tips. Your notes are very clear and easy to follow.

    Nick

  • Leland

    No problem, glad you liked it.

  • http://www.leadhumancapital.com admin

    thanks for the info, I manage to complete the first step( changing my permalink Date and Name option, however, I dont know how to create .htaccess, should I open the cpanel and create a folder for that(in my public html)?

    thank you

  • Leland

    Does WordPress not create an .htaccess automatically? If not, you need to create a blank one in your WordPress root directory and set the permissions to 666 so it can write to it.

  • Excelanto

    Thanks for your valuable posting.I have collect more than information from your website. It is really wonderful blog. please added more than tips. i’m working in best erp software for small business in india.Here providing very low price and Quality ERP,Cloud ERP, CMS , responsive webdesign and ERP. you have any more than information kindly make me call this number 044-42127512 or send your mail info@excelanto.com