WordPress Permalink Structure Guide

Permalinks are nothing but the part of the web address. It comes after the domain name and directs to specific page or post. It is always been a topic of concern that what permalink structure should be preferred. Quite often, I have found people searching for WordPress permalink structure guide. This post details the why and how to change permalink structure without losing the traffic that you already have on your website.

Why should you change your WordPress permalink structure?

The default permalink structure uses the post ID as a unique identifier in the URL:

http://www.yourdomain.com/?p=123

It’s not a good practice to keep website URLs that contain numbers, special characters or any id. I always advise people to get rid of the date in their permalink structure. It makes the website URL a bit shorter and it is always good to have short URLs for Search Engine Optimization (SEO) purpose. On the other hand, having a date in your permalink structure has proven to diminish the Click through Rate (CTR). Moreover, people are just not likely to click on a result that’s two or more years old.

I have heard many people saying that including just a /%postname%/ can cause a serious performance issue when you have a lot of pages
on your blog. Well, it was a real issue a year ago but luckily WordPress have resolved this issue while releasing WordPress 3.3. So you can easily continue to /%postname%/ and stop worrying about the performance issue.

WordPress Permalink Structure Guide

Changing WordPress Permalink Structure

There are many options available under Permalink common setting. You can choose the permalinks structure according to your need. You just need to go to Settings -> Permalinks and select the permalink structure.

E.g., If you have a news website that you can prefer day and name structure.
/%year%/%monthnum%/%day%/%postname%/

WordPress Permalink Structure Guide

Available WordPress Permalink Structures

In case, you’ve chosen to use a “Custom Structure” then there are several other useful structures are available to you:

  • %year% = the year of the post (eg. 2016)
  • %monthnum% = month of the year (eg. 08)
  • %day% = day of the month (eg. 30)
  • %hour% = hour of the day (eg. 12)
  • %minute% = minute of the hour (eg. 09)
  • %second% = second of the minute (eg. 36)
  • %postname% = post slug (post title)
  • %post_id% = the ID of the post (try to avoid)
  • %category% = category slug of where the post is stored
  • %author% = author name

You can use any of these tags listed above to customise your permalink. Make sure to end your permalink structure with %postname%. Here are some other good examples permalink structures:

  • /%category%/%postname% = yoursite.com/category/post-title
  • /%post_id%/%postname% = yoursite.com/123/post-title
  • /%year%/%postname% = yoursite.com/2015/post-title

If you don’t see post name under permalink settings, it means you are still using older WordPress version. I would suggest you to upgrade it to WordPress 3.3 or above.

What happens when you have set this all up but it is not working?

In most cases, you are probably missing the web.config file in root folder of your website (Windows Hosting) or .htaccess file in the root of your WordPress website (Linux Hosting). Now you need to update either web.config or .htaccess file based on your web hosting type.

1. Web.config configuration (Windows Hosting)

Once you are done with the above steps WordPress will notify you to update the web.config file inside the root directory of your website. Follow these steps:

  1. Go to root directory of your website
  2. Open web.config in any of the text editor.
  3. Now replace all the code inside web.config with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

2. .htaccess File configuration (Linux Hosting)

Open your FTP client, connect to your website root folder using FTP details and make sure that .htaccess file is available there and it contains the following code:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

You can find more such Quick & Easy Tutorials on WordPress right now.

Once you complete all these steps, you will find your new permalink structure working quite well. If you find any difficulty, feel free to contact me and do put your views in the comment section below.

Thanks for reading! 🙂

Send this to a friend