Blog

Setting your WordPress Permalinks

We often get asked how to set up certain WordPress settings here at Themify. We thought it would be a good idea to provide some tutorials on how to get started with some of WordPress' features outside of themes. Here is an in-depth tutorial on how to set your WordPress permalinks. To note: A permalink is a link or URL that points to a specific post or page entry.

WordPress Default URLs

The default structure of a permalink uses the post ID as a unique identifier in the url: http://example.com/?p=23

If you're happy with this then you're good to go. But it you're like most people and you want to spice things up a bit more, keep reading on.

Customizing your URLs

To change the default structure to something thats a bit more friendlier and more readable, go to Settings > Permalinks. There you should see a screen that looks something like the image below. In this example we've already chosen to use a "Custom Structure" for our links but you can choose one of the other defaults available if you want.

permalink

Available Permalink Tags

If you've chosen to use a "Custom Structure" then there are some useful tags available to you:

  • %year% = the year of the post (eg. 2010)
  • %monthnum% = month of the year (eg. 08)
  • %day% = day of the month (eg. 25)
  • %hour% = hour of the day (eg. 16)
  • %minute%  = minute of the hour (eg. 29)
  • %second%  = second of the minute (eg. 12)
  • %postname%  = post slug (post title)
  • %post_id% = the ID of the post
  • %category% = category slug of where the post is stored
  • %author% = author name

You can use these tags listed to customize your permalink like we have in the image example above. Make sure to end your custom URL structure with either %post_id% or %postname% so WordPress has a unique identifier to point to. Here are some good examples of common, custom, permalink structures:

  • /%category%/%postname% = yoursite.com/category/post-title
  • /%post_id%/%postname% = yoursite.com/23/post-title
  • /%year%/%postname% = yoursite.com/2010/post-title

Adding to your URLs

You can also add a string, including file extensions, to the end of the url as seen in the examples below:

  • /%category%/%postname%/ = yoursite.com/category/post-title/ (forward slash added)
  • /%category%/%postname%.html = yoursite.com/category/post-title.html
  • /%category%/%postname%.php = yoursite.com/category/post-title.php

You can, technically, add anything to the end of the URL and WordPress will interpret it properly. This is useful if you are migrating from a static html site and you want to keep the old URL structure.

Categories & Tags

By default WordPress uses "category" and "tag" as the base name for the category and tag archives respectively. You can rename these under the permalink settings as well. A good example of why you might change these base names would be if your blog was all about cars. It would look a lot nicer if you changed the category base name to "car" and the tag base to "model". This way your category URL structure will look something like yoursite.com/car/category-slug and the tag URL structure would be yoursite.com/model/tag-slug. Here's what those settings would look like:

category + tag base name

.htaccess File

What happens when you've set this all up but its not working? In most cases, you are probably missing the .htaccess file in the root of your WordPress install. Open up your FTP client, connect to your server and make sure that there's a .htaccess file and that it contains the following code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Reference: for more information about WordPress permalinks, visit WordPress codex.

35 Comments

  1. Zaid Pirwani
    Mar 10, 2011 @ 19:37

    Hi, nice summary of the reference at WordPress Codex….

    But, I think you should have also mentioned the Best Practice, in terms of PRETTY LINKS.

    “For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. ……… So, it is best to have at least two path segments in your post’s permalink structure such as /%year%/%postname%/ or even /posts/%postname%/ ……. (Some people recommend /%post_id%/%postname%/ which works for performance reasons but….”
    Reference: http://codex.wordpress.org/Using_Permalinks
    (I intentionally left the But their)

    I think if small site, go with only /%postname%/ otherwise use /%post_id%/%postname%/

    Reply

  2. Zaid Pirwani
    Mar 10, 2011 @ 19:38

    BTW /%post_id%/%postname%/ provides a good short-url or sorts, you can use the same url without the name part and only the post-id.

    I just wanted to clarify that I am not too bright, so help me “Other People Who Know Better”.

    Reply

  3. Nick Plekhanov
    Mar 10, 2011 @ 20:47

    Handy info. Thanks.
    Keep tutorials like that up! You guys rock!

    Reply

  4. العاب
    May 18, 2012 @ 14:45

    I changed my permalinks to
    /%category%/%postname%.html
    it works fine
    thanks

    Reply

  5. Baraja Blog
    Nov 08, 2012 @ 10:02

    Thank you!
    Really nice post.. It’s Work in my blog with /%postname%.html permalinks.
    I’d like to improve my knowledge in wordpress

    Reply

  6. Nipun kumar
    Jan 17, 2013 @ 05:21

    Hi guys,

    I am facing a problem with custom permalink as i am using wordpress for article section of my site and when i am using custom structure /%category%/%postname%.html but it didn’t work for me .
    I am using this structure because i have some urls those are without .html extension and i want to open those urls with html extension.
    thanks in advance for any help.

    Reply

  7. sabrian
    Jan 30, 2013 @ 05:55

    just one query if i change from default to custom .. will it make impact on existing url?

    Reply

  8. Mike Bernard
    Mar 08, 2013 @ 19:16

    Hi,

    I have just migrated my 60 page website from a flash based site to wordpress.

    This post has been helpful to convert my urls from one site to the other.

    Thankyou :-)

    Reply

  9. biloggirl
    Jun 28, 2013 @ 05:49

    Hi I have a problem may url permalink is missing.

    Right after I published a post, the built in permalink created as:

    permalink: /my-first-post/

    I am expecting Permalink: http://www.margebuot/my-first-post/

    Please help me.

    Reply

  10. Yury
    Sep 21, 2013 @ 16:42

    is it possible to get following permalink strukture:

    /%postname%/ – for pages

    AND

    /blog/%postname%/ for blog-pages?

    regards

    Reply

  11. shakil
    Dec 27, 2013 @ 10:32

    nice tutorial. i think %category%/%postname% would be better. it’s more readable and meaningful url

    Reply

  12. Belajar SEO
    Feb 05, 2014 @ 09:41

    This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more … good luck

    regards
    belajar seo

    Reply

  13. Jeffrey Wattles
    Feb 07, 2014 @ 23:56

    I couldn’t understand the Word Press doc on this topic, but your better explanation enabled this newbie to solve the problem I was having by myself–which makes me feel proud. Nice work, indeed!

    Reply

  14. jasa toko online
    May 18, 2014 @ 17:05

    Initially very confusing how to alter the permalink become seo friendly, but it is very easy
    thank you for your tutorial
    Regards

    Reply

  15. Chord Lagu
    Aug 25, 2014 @ 07:44

    according to SEO experts, permalink setting is great for SEO boost, but I am still confused about the best permalink settings. whether use published date or directly such as post title.

    Reply

    • Nick La
      Aug 25, 2014 @ 18:20

      Post title would be more URL/SEO friendly.

      Reply

  16. Gaush Alam
    Nov 25, 2014 @ 16:19

    Great Post ! What should be best permalink for WordPress blog ?

    Reply

    • Nick @ Themify
      Nov 28, 2014 @ 00:05

      It depends on what you need. The category and post title seems to be the most commonly used because it tells the subject and title.

      Reply

  17. 2016 Volvo XC90
    Feb 01, 2015 @ 03:25

    Wow . . . Good Information for me and other sir . . . I will read other tutorial Thanks Sir :D

    Reply

  18. modifikasi motor injeksi
    Feb 13, 2015 @ 12:16

    Spot on with this write-up, I seriously think this web site needs much more attention. I’ll probably be back again to read through more, thanks for the information!

    Reply

  19. Rumah Ayu
    Mar 07, 2015 @ 09:52

    Thank you for another essential article. Where else could anyone get that kind of information in such a complete way of writing? I have a presentation incoming week, and I am on the lookout for such information.

    Reply

  20. Noman
    Mar 31, 2015 @ 21:45

    I think we should use Customize our permalinks because it’s makes our wordpress url clean and seo friendly.thanks for your useful post :)

    Reply

  21. Rina Gonjreng
    May 28, 2015 @ 04:32

    hey, i saw your post about permalink is very useful to increase my visitor UX. if i use the right type of permalink, it will makes my visitor easily remember the title of my post. tks for sharing.

    Reply

  22. Gez Cooper
    May 28, 2015 @ 16:13

    hi i a events page which displays all our company events. I wish the events to be displayed in date order. how do I do that and what code do I need to put where?

    Please help its driving my mad.

    Reply

    • Kurt Uy
      May 29, 2015 @ 16:14

      Hi,

      You can change the order of your event based on the date by following this tutorial link. It outlines if you would like to do query your events or what you need to add if you would like to display it as a shortcode. If you need any further clarification with this, please do not hesitate to email us at info[at]themify.me

      Reply

  23. Kebaya Modern
    Feb 22, 2016 @ 06:36

    Handy info. Thanks.
    Keep tutorials like that up! You guys rock!

    Reply

  24. Jonathan Gonzales
    Feb 22, 2016 @ 07:49

    the most simple step to setting permalink I found in here… thanks for sharing sir :)

    Reply

  25. Chad Nilsson
    Mar 24, 2016 @ 16:00

    Is there any way to alter the url for only specific pages? The client I’m rebuilding the site for has requested that I change the url’s for some of the pages to keep their existing SEO authority, but some end in .php and others are just normal. All the solutions I’ve found change the extension for EVERY page URL and I just need to add .php to certain pages. Any thoughts?

    Reply

    • Nick @ Themify
      Apr 07, 2016 @ 18:23

      You can add .html at the end of the permalink, but not .php (eg. /%category%/%postname%.html)

      Reply

  26. resep kue kering
    Apr 03, 2016 @ 05:42

    I changed my permalinks to
    /%category%/%postname%.html
    it works fine
    thanks

    Reply

  27. Apkmod
    Sep 21, 2016 @ 09:47

    I am using this structure because i have some urls those are without .html extension and i want to open those urls with html extension.
    thanks in advance for any help.

    Reply

  28. Lagu gratis
    Feb 13, 2017 @ 15:43

    Hello,
    How to include the sub category base in the URL, I mean

    Website,com/category/subcategory/post

    Please help me out. Please make a video tut.

    Reply

  29. Indra
    Mar 26, 2017 @ 09:58

    It’s work, thanks!

    Reply

  30. Sarah
    Sep 07, 2017 @ 15:27

    Permalinks is one of the first things I fixed when I started using WordPress. Its great to read the reason why and the impact it has if you don’t. Thanks great article.

    Reply

Reply