Permalink means how a URL of a WordPress post appears. To have nice looking Permalinks, your web server should be Apache with mod_rewrite module. Almost all Linux web hosting packages are in this configuration. But be sure before choosing a web host if you really want Permalink functionality.

Setting your desired Permalink structure is a very first thing you should do after installing your WordPress blog because search engines index your blog based on post URLs and if you change from one to another then you will loose your rankings. And also other web sites link to your blog using them and changing can also stop those traffic flows. To configure your Permalinks click Options tab in your WordPress Dashboard and then Permalinks.

WordPress Permalink Types

Which Permalink Structure Is the Best?

Obviously Default and Numeric won’t be your options. You may also not want to bother with Optional suggestion. You will have to choose between Date and name based and Custom. Date and name based will be great if your blog is more news oriented and less categorized. But if your blog consists of many all-time articles and can be well categorized then you better go with a Custom Permalink structure.

Custom Permalink Types

You can use number of variables to define your Permalinks. You can get all of them and some other information at WordPress Codex. Most of the time, you will only need %category% and %postname%. You need to use forward slashes ( / ) to separate these variables. Followings are the highly used custom Permalink structures.

/%category%/%postname%/

Probably this will be your choice. It tells the user to which category the post belongs. A sample post will be like below. Here technical is the category and understanding-web-technologies is the post name. Post name is created using your post title (If you didn’t change Post Slug manually). All the letters are converted into lowercase and words are connected with hyphens (-). If the title contains special characters like question marks (?) then those will be removed.

http://www.homebizpal.com/technical/understanding-web-technologies/

If a post belongs to a child category then both parent and child categories will be displayed. Parent name comes first. For an example this post belongs to WordPress category which is a child category of Blogging and the URL is like below.

http://www.homebizpal.com/blogging/wordpress/understanding-wordpress-permalinks/

Very Important!

If a post belongs to two categories then the one with a top category ID will be selected as the category name (Note that category IDs are assigned according to the order you created them, not according to alphabetic order). For an example Understanding Alexa Rank belongs to both SEO (Category ID is 10) and Technical (Category ID is 5) and Technical has been used as the category name since it had a top category ID. The URL is as below,

http://www.homebizpal.com/technical/understanding-alexa-rank/

What would happen if I assign another category to the post? If the category ID is below the current one then there won’t be any problem but if it is above then that category name will be applied and whole URL will be a new one which you should take care not to happen. So, be careful about it before assigning a new category. For an example if I assigned General (Category ID is 1) to above post then the URL will be changed as below.

http://www.homebizpal.com/general/understanding-alexa-rank/

/%postname%/

This will only display the post name in the URL. This can be used if your posts can not be categorized well. Assigning new categories or changing them has no effect on this structure.

/%category%/%postname%.html

Some are also using this structure which will make URLs like below. The intention is to show posts as static HTML pages.

http://www.example.com/category/postname.html

How to Recover After Changing Permalink Structure

As stated, you should take care not to change Permalink structure after your blog has been established. However if you blog is new and you really need to change the structure, you can redirect old URLs to corresponding new URLs using 301 redirects which is also a search engine friendly way. If you changed from one structure to another, WordPress may ask to paste a peace of code to your .htaccess file which you also need to set your 301 redirects.

.htaccess is a simple file that Apache web server uses to get webmaster inputs. You can do things like creating password-protected directories and redirecting with this file. It should be placed in your root directory of your web site. If one is not already available, simply open a text editor, enter instructions you want and save the file as .htaccess and upload it to your server. You can create a 301 redirect as below.

redirect 301 /2006/12/18/postname/ http://www.example.com/category/postname/

Here the old post URL,
http://www.example.com/2006/12/18/postname/

will be redirected to new URL,
http://www.example.com/category/postname/

Note that in the definition, first part is the old URL without domain name and the second part is complete new URL. Keep whole definition in one line (Don’t include line brakes using Enter button). Also note where to apply spaces (There is a space between old URL and new URL).

Recovery Plugins

Dean Lee has developed a Permalinks Migration Plugin for WordPress which lets you migrate from one structure to another without loosing your SE rankings or visitors. It creates 301 redirects for you. As reported, it hasn’t worked for some people. Try it yourself and see. You may also want to install Alex King’s 404 Notifier which reports broken links in your blog to see whether everything is going right.

Permalink Effect in Search Engine Optimization

Including relevant keywords in your URLs rather than numbers or special characters (? and %) is a really good way to fine tune your search engine optimization. Categorizing also gives good clues to search engines. You can achieve these using custom Permalinks. Note that major search engines like Google can also index URLs with ? and & characters. Therefore you will get an advantage only when you have got other factors right.

Digging through Permalinks

Actually major advantage of a good Permalink structure is usability. They are informative and users can view other posts in a category very easily. For an example by removing understanding-wordpress-permalinks in URL,
http://www.homebizpal.com/blogging/wordpress/understanding-wordpress-permalinks/

makes,
http://www.homebizpal.com/blogging/wordpress/

where you can see all the posts in WordPress category. Further removing wordpress part will list all WordPress related posts as well as the ones which only belong to Blogging category. Same happen in Date and name based structures. Removing the date will list all posts for that month and so on.


  1. ravianz

    thats useful info. thanks for all this;

  2. Adam J.

    I have a relatively established blog and have been thinking of changing my permalink structure for better search engine rankings. So far a have about 350 posts from the last 2 years. Is my best option to create a custom slug for every post from now on, or is there a nice way to switch over? I’m pretty sure a custom slug is the way to go, but I just thought I would ask.

  3. Gaya

    Adam,

    You have to think twice in this decision. If you change the Permalink structure then it will not only change the URLs of upcoming posts but also URLs of past posts. You can create 301 redirects to all 350 posts. But again it’s a big work and you will temporarily loose your Google Page Rank which then can lead to loose your rankings in Google.

    Search Engine Journal is a blog about SEO but it also uses numeric URLs like you which reminds us that URL structures are minor facts “comparing” to other SEO facts. But when you have other facts right, well structured URLs will give you more advantage.

    If you are going to change your structure, be sure to install Alex king’s 404 Notifier plugin. It will tell you what has gone wrong.
    http://alexking.org/projects/wordpress

    Update me with your progress. All the Best!

  4. Denis de Bernardy

    I wish people would stop inviting their readers to use things like:

    /%category%/%postname%/

    Those who do are obviously not taking care of support issues related to it. Long story short, it’s a horrible option when it comes to server performance because it introduces imprecisions in the url (e.g. you could have a post and a static page with the same url).

    D.

  5. Gaya

    Denis,

    I can’t figure out what’s your point. If you use that Permalink structure there won’t be any issue at all. In case you have one, there is a dedicated WordPress support team. As observed there is no significant issue on server performance by using this structure.

    “you could have a post and a static page with the same url”

    This is a basic fact that any webmaster should be aware of. There is no need to sacrifice all the other URLs of your web site just to keep few static URLs. All static URLs are made manually. So, you have enough chance to prevent any conflict.

  6. Dean Power

    Great article. Permalinks can be really tricky to get your head around, and much of the advice is really snappy and pitched at some who understands apache, php, and sql. I am definitely bookmarking this one.

  7. saumendra

    thankx for this helpful article

  8. Alan

    Hello Gaya,

    Thank you for all of the information that you provide on your website. It’s quite helpful.

    I have a question about Permalinks that might be beyond the scope you were intending when you started this topic.

    I was wondering what code (.php procedure) assigns the post i.d. (that includes the permalink) to new posts? I’d like to change the entire link (not just the category and post identification).

    Here’s why: My web hosting service allows me to have multiple domains on one account, but only the primary domain supports MySQL. So, in order for me to set up WordPress on my secondary domains, I used the domain’s fixed I.P. address.

    This works fine (in fact, it seems to be the only way WP will work in this situation) except for the fact that the generated links include the IP (which, of course, makes sense) instead of the domain name.

    I’d like to have WordPress assign a post id that uses the domain name and not the IP. I already have a PHP routine in place that will convert the domain-name-based link back to an IP-based link.

    My goal is that users only see the pretty name in the links.

    If you happen to know the answer to this, it would be greatly appreciated.

    Thanks… alan

  9. Gaya

    Hi Alan,

    Thanks for pointing your issue here. I think, here you have to modify the core file which is responsible for Permalinks. This is possible since WP is open source. By tweaking your developed routine and with the help of WP Support, you can get it done. I am afraid I can’t help you in detail since I haven’t done such thing before.

  10. Alan

    Thanks, Gaya.

    I’ll check it out.

    … alan

  11. Mingan

    Hi, thanks for the article, spent hours digging through the documentation Wordpress provides, but your info is a lot easier to use. Thanks again.

  12. SourceV

    Is it possible to change the category URL so instead of http://example.com/category/category_name/ it will be simply http://example.com/category_name/

  13. Gaya

    Hi SourceV,

    I can’t understand what you mean by category_name. Is it post name? Anyway as stated in the article, there are many variables you can use in your Permalinks. Just remember to use them within % signs and then use a separator around them (/ sign). So, if you just need the post name, you can set it as below,

    /%postname%/

    When the URL is generated, it would be as below,

    http://www.example.com/post-name/

  14. SourceV

    I am not talking about the URL to the post, I am referring to categories. As you know Wordpress allows the creation and Management of categories to which you can relate your article. In your blog you call them topics. For example, you have a topic named: AdSense and the URL to it is: http://www.homebizpal.com/category/adsense/

    What I would like to achieve, if possible, that instead of above permalink, the following: http://www.homebizpal.com/adsense/

    you see I have taken off the ‘category’ portion of the permalink.

    Do you think it is possible?

  15. Gaya

    Hi SourceV,

    Sorry, I don’t know a way to get this done. Have you
    asked WordPress support?

    Anyway, if you typed,

    http://www.homebizpal.com/adsense/

    WordPress would automatically redirected it to,

    http://www.homebizpal.com/category/adsense/

    So, I think you can use either URL as a reference.
    But SEs list the latter since its the visible one to them.

  16. SourceV

    Thanks.

    If it redirects, then there should be a way to hack it. I will let you know if I find anything.

  17. SourceV

    Hi Gaya,

    I have not found how to get rid of the /category/ in the URL, but I have found out you can replace it with something else.

    In the admin section: Options -> Permalinks, under ‘optional’ you can replace the ‘Category base’ with whatever you wish.

  18. Gaya

    Hi SourceV,

    Thanks for your input. It will be helpful to anyone who has the
    issue.

  19. shortans

    How do I get the complete URL for a post using permalink functions? I have a php script and want to generate the complete URL for a post within the php function. I went thru Wordpress docs, but can’t seem to find much info

  20. shortans

    After some trial and error guesswork, I found the function to retrieve permalink from php script. Here it is -
    get_permalink($post_id)

  21. Gaya

    Hi shortans,

    Thanks for your input! Your finding will be helpful to those who intend to tweak Permalinks.

  22. Bingomaster Breakout

    SourceV had a very interesting point:

    When using the “/%category%/%postname%/” structure and clicking on a category, let’s say: “news”, you get something like:

    www.my-domain.com/category/news/apple-releases-new-imacs

    It would be great if “/category” could go away.

    I played a little around with the url settings to get rid of it – and it is possible if you use other variables for the urls.

    But this is no real solution because it causes new unwanted urls.

    Just as an example (I know it still contains “%category%”, but what I want to show is just how the different variables have weired effects on the url):

    I switched to “/%category%/%post_id%=%postname%”. And all over a sudden clicking on a montly archive does not create an url like “domain/2007/08/” but “domain/date/007/08″.

  23. Guðmundur

    Hello man. I´ve just set up my first wp site, using wp as a cms system. It´s an icelandic site so the: /%category%/%postname%/ get´s a bit screwy with icelandic characters. Is there any way for wp to translate some of the letters to something meaningful?

  24. biggles

    Hi, I have a wordpress site where each wordpress Page is assigned to a separate category, and then posts can appear below the static Page post at the top (hacked wordpress to do this).
    I would like to create a friendly URL for just ONE category (web-page) - is that possible without mod-re-write etc. I am thinking that a single re-direct would work.. Any thoughts appreciated!
    Thanks
    Biggles

  25. Joy

    For SourceV: there’s a plugin at WordPress called Top Level Cats that gets rid of the word ‘category’ from your permalinks. It works great!

    For biggles: There’s a plugin called Page2Cat that lets you assign a page to a category to use as an intro page. It might make it easier on you, especially when you want to upgrade WordPress.

    For those that need more than one permalink structure (like Adam): There’s a plugin called Advanced Permalinks that lets you assign a different permalink structure to different ranges of post IDs. So you can say zero through 350 is one way and 351 through -1 (his way of indicating open ended) is the new way.

    As for using a structure like /%category%/%postname%/, that is my preference but it wasn’t working for me when I had posts in child categories. That may be because they had an old date related structure stored in the database, but I was using the Top Level Cat plugin at the same time, so I’m not sure which was causing the problem. I’ve seen several people advise using just /%postname%/ but WordPress says you’ll have problems accessing wp-admin and/or stylesheets, so I’d think having the category in there would be about the same thing. (Except that the category names are known, and they show up in the rewrite rules, so it’s more likely to work right.)

  26. Max

    HI
    Was a little confused with permalinks but now I have a better understanding thanks for the great Info Gaya.
    Max

  27. Andrew

    Hie Gaya,

    I am a newbie to wordpress and have been working on blog for a friend’s site - blessedwithoutlimits.com. I have got a grip on a few wordpress features as you can see - blessedwithoutlimits.com/blog.
    My problem? - Pretty permalinks.

    I have toiled so hard to get them right but when I click any link, my layout messes up. The images/background disappear/s. NB: My wordpress is installed in a folder “blog” and not on the root of the site.

    I came across this tutorial and gave it a go. I set my structure to /%category%/%postname%/, copied .htacess to /blog folder and installed and activated top-level-cats.php plugin.

    I noticed the urls changed and “category” does not show up. Well, that’s about all. Anyway, I’m still experiencing the same problem as before. Can you please help me out on this. I have no idea what to do next. I hope to get this fixed before I can start blogging.

    Thanks Pal and continue doing a good job.
    Andrew

  28. Andrew

    Sorry, my url (optinal) should have pointed to the Blog.
    Thanks

  29. drevajes

    I evenly ever squeal you, and when I do we sultrily speak.

  30. Sim Kamsan

    Great tutorial, thanks

  31. rienarry

    How to recover after changing permalink structure this lead to confusion for newbies.. for new wp users, i think they should know how to configure wp at the first step after installing the wp. besides, it will affect in serp indexing

  32. Gilbert

    Is it possible for permalinks structure to make one of the page as my index page.

    What i mean is that i dont like my post on my home page, i want to make a custom homepage for my blog and creating another page is the solution but i dont know how to redirect the index page to that specific page that i created to be my homepage.

  33. Rukshan Kothwala

    This post is a best one about “wordpress Permalinks”. i also agree with custom type.

Places This Post Was Mentioned

  1. 1 Free Site Review - The Asian Economist

    […] One thing I have to complain about is that he does not have his blog’s permalinks SEOed which could hurt him getting any results from search engines. Here is a nice tutorial explaining how to make your wordpress permalinks SEOed properly using .htaccess. I also suggest that you make sure your wordpress and blog address include www. To do this simply login to your admin cp and go to options and find the links and add “www.” after “http://”. This way search engines don’t confuse your site as two different ones. […]

  2. 2 URLs and SEO and Internet Marketing

    […] Understanding WordPress Permalinks — “Setting your desired Permalink structure is a very first thing you should do after installing your WordPress blog because search engines index your blog based on post URLs and if you change from one to another then you will loose your rankings. And also other web sites link to your blog using them and changing can also stop those traffic flows. […]

  3. 3 Mastering Your WordPress Theme Hacks and Techniques

    […] 2) Understanding WordPress Permalinks- Which Permalink Structure Is the Best? […]

  4. 4 mlm business opportunity network marketing

    mlm business opportunity network marketing…

    This ia a good website….

  5. 5 paidnetpedia.com

    […] 2) Understanding WordPress Permalinks- Which Permalink Structure Is the Best? […]

  6. 6 Google Magic Formula

    8 google magic formula…

    Google Magic Formula…

  7. 7 SEO & Web Design » Blog Archive » Mastering Your WordPress Theme Hacks and Techniques

    […] 2) Understanding WordPress Permalinks- Which Permalink Structure Is the Best? […]

Leave a Comment






Full RSS Feed


Newbie Guide


Recent Posts


Topics


Free Tools


Credits