post-page

Configuring WP Permalinks

66
responses
by
 
on
January 16th, 2008
in
HOW-TO, WordPress FAQs

Pretty Permalinks

Quite often, we hear of the terms (permalinks or pretty permalinks) which can also be called SEO-friendly URLs. These URLs are not only SEO friendly, but I believe they are human friendly as well. By default, WordPress uses URLs that look like a mishmash of letters and numbers with a few question marks mixed in for good measure. These types of links are frowned upon by search engine spiders and as a human being, they are also hard to read.

Fortunately, WordPress provides a way for us to change this linking structure to something understandable. WordPress calls these Permalinks. Permalink settings can be configured a number of different ways. One of the ways to quickly configure permalinks is by choosing one of the Common Options. These common options include:

Default – http://www.domain.com/?p=123

Date and name based – http://www.domain.com/2008/01/15/sample-post/

Numeric – http://www.domain.com/archives/123

There is no sense in using the default option so choose either Date and name based or Numeric if you don’t feel like tinkering with the Custom Structure.

The custom structure of the permalinks settings area allows you to customize the way permalinks are displayed by using any combination of the following permalink tags.

%year% – 4-digit year (for example, 2008)

%monthnum% – 2-digit month (for example, 01 for January)

%day% – 2-digit day (for example, 15)

%hour% – 2-digit hour of the day (for example, 20 for 10PM)

%minute% – 2-digit minute (for example, 50)

%second% – 2-digit second (for example, 24)

%postname% – Text separated by dashes which usually ends up being the post name. (for example, configuring-wp-permalinks)

%post_id% – The unique, numerical ID of the post (for example, 124)

%category% – The text of the category name that the post is filed in (for example, how-to)

%author% – Text of the post author’s name (for example, ronald-huereca)

Example of custom structure in use:

Custom Structure: /%year%/%monthnum%/%day%/

Link Output: http://www.domain.com/2008/01/16/

Make sure that you include the back slashes at the beginning of the custom structure, after each tag and at the end. This will ensure that WordPress writes the correct rules in the .htaccess file via mod_rewrite.

For my own blog, I seem to have done fairly well in the search engines by using the Custom Structure method and using the %postname% tag. I can’t say for sure which combination would do better or worst for search engines. The only thing I can suggest is that you configure your permalinks to look whats best for you.

*WARNING*

Changing the structure of your permalinks affects all of the permalinks on your blog. This is important to know because search engines will have indexed posts on your site via their permalinks. If you change the permalink structure mid stream, you will end up invalidating all of those links.

What to do if you don’t have a .htaccess file?

If you notice that you don’t have a .htaccess file within the same directory as your WordPress installation, you can create one by first creating a blank .txt file and saving the file as htaccess.txt. Upload this file via FTP to the same folder that houses your WordPress installation. Once the file is uploaded, set the permissions to the file as 666. Next, rename the file to .htaccess. Now you should have a blank .htaccess file for which WordPress can write the proper permalink rules to.

Servers That Don’t Use Apache Or mod_rewrite.

If the webhosting server you are on does not have the apache module mod_rewrite enabled, you can still use the permalink settings in WordPress by placing index.php in front of any custom permalink tags.

For example: /index.php/%year%/%monthnum%/%day%/

Equals: http://www.domain.com/index.php/2008/01/16/

Using index.php in this way eliminates the need for a .htaccess file.

I hope this little primer on how to configure your permalinks within WordPress was helpful. I’ve seen too many blogs out on the net that have yet to take advantage of this awesome feature. As I’ve said before, using any sort of permalink structure is better than the WP default. Not only is it beneficial in terms of SEO, but it also makes it easier for human beings to see at a glance, what a particular link is pointing to without having to visit the page.

If you use the custom structure aspect of permalinks, I’d be very interested in knowing which configuration of permalink tags you have chosen to use and why.

heading
heading
66
Responses

 

Comments

  1. Emon says:

    What if I wanted to change the title tag structure so it changes only the posts I submit from here on while keeping the numeric structure I’ve always had from the past posts?

    I understand I’m stuck with the numeric structure I have now since Google and others have indexed or linked to those posts like that. Or am I not really stuck?

  2. pundit says:

    Emon: You don’t need to worry about it. The (pretty) permanent link structure you define is in addition to the default ?p=blah format that WordPress uses.

    Using a random post from my journal for e.g., both http://emphaticallystatic.org/.....dy-waters/ and the default http://emphaticallystatic.org/?p=1070 will take you to the same post.

  3. Peter says:

    http://perishablepress.com/pre.....wordpress/

    Permalink URL canonicalization is automated via PHP in WordPress 2.3+, however, for those of us running sites on pre-2.3 versions or preferring to deal with rewrites directly via Apache, comprehensive WordPress URL canonicalization via htaccess may seem impossible. While there are several common methods that are partially effective, there has not yet been available a complete, user-friendly solution designed specifically for WordPress. Until now..

  4. Alisko says:

    it’s a good post.
    i am using only %postname% tag as you

  5. Keith says:

    What about category permalink tags?

  6. Jeffro2pt0 says:

    I deliberately skipped the category permalink tags but if you want, I can go ahead and include the information for those as well. I didn’t think those were a big deal to include.

  7. PJ says:

    I use the date/name option, which has worked well for my blog so far.

  8. Great post. I use the date and name based permalinks also, but I never liked using index.php in the permalink, but I supposed if you are not running Apache and mod_rewrite, you don’t have much of a choice.

  9. Ted Clayton says:

    I second the request for a category-treatment, avoiding the insertion a ‘category’ dir-level. I used the Custom interface, copied the .htaccess file it rendered, uploaded it to my root, which the host allows. I had previously successfully used .htaccess customizations to do other things. But the WP-generated script (untouched by me) ‘scrambled’ my URLs, and I couldn’t get it off the server fast enough. I suspect I misunderstood – though I studied multiple sources – how to build the customization-terms.
    Thanks – I don’t like my ugly URLs either! 😉

  10. dave says:

    I’ve been using the default structure the whole time I’ve had my blog. I’ve got nearly 10,000 posts already, and found that for the type of content I use on my site, having the post ID in the permalinks works to my advantage in a way, so I never changed it.

    I’ve always been hesitant to change it from the default because I don’t want it so that you can’t get to a post without using the default way, but I guess it works anyway according to pundit…I’m kind of at an impasse as far as deciding whether I should bother using them or not.

  11. Bill says:

    As a rookie blogger I had setup my permalink using a structure I thought that I wanted but it did not include the postname. After a few months I changed it and of course all of my linking that was already indexed by the search engines broke and everyone ended up on the home page with a not found… Word of caution if you change from a non-default permalink structure to something else. You do get re-indexed eventually but that link is out there at a lot of places besides the search engines.

    • I made this same mistake, as well as having to move my blog from one server to another. The really bad part about making these changes was having to go back through all of my blog posts and pages update my links wherever I had linked from one post to another. Luckily, I changed over relatively early in the game, when I only had a few dozen posts to deal with.

      The thing that really stinks is that brand-new bloggers have about a 0% chance of finding a post like this before they make the same mistake. Still, like most things, it’s live and learn, and if you have to go through that pain once, you never make the same error again if/when you start another WordPress site.

      • PS Forgot to answer your question 🙂 I use /%year%/%monthnum%/%day%/%postname%/ on my main blog, as much of the information on it is timely. On another blog, where the information doesn’t go out-of-date so quickly, I use just /%postname%/.

  12. Tadd says:

    I use the /%year%/%monthnum%/%day%/%postname%/ option for my blog. I’m not a superblogger now, but I figured it would be better to have a good structure in place … I can have a lot of similar post names and be ok if they’re on different days or years … always trying to think ahead 🙂

  13. Jeff says:

    Two of the most useful plugins when it comes to cleaning up wordpress url that you neglected:

    http://fortes.com/projects/wor.....evel-cats/ — Allows for /%category%/%postname% urls. Also makes /%category% work appropriately.

    http://urbangiraffe.com/plugins/redirection/ — SO useful. If you are using %postname% in the url then this is amazingly handy as it will let you change the post slug (url) and put a 301 in place for you. It also tracks 404’s so you can fix previously old broken links AND the redirects suport regex, so if you need to redirect an entire series of similar links to somewhere appropriate it’s useful

  14. LiewCF says:

    I have been using a permalinks structure for a long time. How do I change the permalinks structure, AND ensure that the old permalinks will be redirected to the new one?

  15. Camiel says:

    Great article! I wrote a blog post in the past about how you can enable WordPress permalinks on a Microsoft IIS Webserver using isapi rewrite. By default it’s not possible to use permalinks on IIS because IIS doesn’t support mod_rewrite.

    The post is located here:

    http://www.schoonens.nl/camiel.....i-rewrite/

  16. Monika says:

    LiewCF
    if you would like to change the permalink structure and safe your old lnks–

    you need information about:
    Redirect pernanet 301
    RedirectMatch permanent

    there are a lot of tutorials in www. – for dummies like me 😉

    regards
    Monika

  17. shadaik says:

    Well, Google is indexing the default ones, I had them running for weeks now and postname seems not to works on Pages, but only on posts (tested it). Thus, I’ll stick with the old ones.

  18. Dhruva Sagar says:

    I had struggled a lot myself in trying to get the permalink format of my choice to work on my blog. But in the end I had to give up trying it. My hosting did not allow me to define my own .htaccess file and because of that I had a lot of confusion and irritation in the beginning.

    Eventually I had to sought to the last resort of using the index.php within the permalink structure, it worked for me like a charm and I have been enjoying very much since that day :).

    Nice post.

  19. Flo says:

    Because wordpress should be as transparent as possible, I think the best alternative for your urls is the simple /%postname%

  20. Paul says:

    For my blog I use the permalinks with the date format. But on sites where I use WordPress as a CMS I prefer /%category%/%postname%/ with carefully selected category names. Works fine.

  21. Ted Claytont says:

    @Jeff #13 – Thanks for these plugin-links. I think these will get me on the program!

    This may a bit contrary to the spirit of this excellent topic … but after I was humiliated trying to do category permalinks, I noticed that Google was actually indexing my stuff anyway, very closely (hours). Permalinks are supposed to be good for SEO. Now, few people besides me, Google, MSN Bot, Yahoo, Inktomi, Ask Jeeves, and a stack of lessor but attentive engines know about my pages. But, I’ll tell ya … I keep an eye on it these days … Google and all the rest absolutely pound my blog. No lie.

    They just gobble up those ugly URLs! 😉

  22. Pryordurkin says:

    Thanks for the info. Being new to this game, I never quite knew what permalinks were for. Having read your article I am much better informed.

  23. paulierco says:

    A great ideea is with html http://www.paulierco.com/2008/.....-post.html , is more optimized and indexed by google and other search engine. Permanent link ” /%year%/%monthnum%/%day%/%postname%.html “

  24. Weathervane says:

    Dumb question but I just want to check that permalinks are only for Unix.

  25. bubazoo says:

    I use %postname% also. I thought about using %category%/%postname%
    except for one problem. I have an “about” page, and another custom page, and I don’t want %category% to show up on those pages, cuz it would look dumb to say domain.com/pagename/about instead of domain.com/about so I decided to leave the %category% tag out, but I wish there was a way to make it so posts would show %category%/%postname% while pages just show up as %postname%

  26. bubazoo says:

    either that, or a way to exclude a certain page from using permalinks (like my about mage) then have posts show up as %category%/%postname%
    and pages as page/%postname% in other words, more flexibility like that.

  27. Ted Clayton says:

    @Weathervane #24 – I think not-Unix falls under the section in the lead-article under “Servers That Don’t Use Apache Or mod_rewrite.” The options are hemmed in by an additional requirement, but still does it.

  28. Paul says:

    You could manually put rewrite rules in your htaccess file to exclude %category% from your static pages like your about page.

  29. Jeffro2pt0 says:

    Perhaps you could also edit the PAGESLUG for those, or maybe the easiest way would be to go with Paul’s suggestion and manually including the rules in the .htaccess file.

  30. Gazza says:

    Be aware of using the %category% in custom permalinks: http://trac.wordpress.org/ticket/4699

  31. Ted Clayton says:

    @Gazza #30 – Thanks for the illuminating trac-ticket link.
    For WordPress sites that are more blog-styled, the date-based permalinks seem to be a good option. For sites that are more CMS-like, and using Categories to organize access to content … it seems more a work in progress. 😉
    Two points. 1.) Inserting an extra, ‘non-functional’ directory-layer in the form of my-domain/category/category-1, appears to me to be “unsemantic”. It looks – logically – the same as the sophomoric web-tyro error of making a subdirectory for the homepage, and using my-domain/homepage/index.htm. Superfluous, and implies a semantic relation that is both spurious & nonexistent.
    2.), worse, really, is that we can assign a post or other entry to multiple categories – and this is a good & attractive thing. Yet, when forming a permalink, only a single category-membership can be used. If we are going to give content-items membership in multiple categories, we create a basic logic-problem for permalinks. Presently, this appears to be resolved as a ‘race’ – whichever category-ID is encountered first becomes the permalink. That can easily upend & confuse intended hierarchical relationships.
    2a.) The flexibility of category-assignment is important to me. I intend to reorganize my material from time-to-time. Much of my site-organization is impermanent, by design.
    ID-numbers – the real permanent links – are admittedly ugly, but they are semantically valid.
    These comments pertain more to those using WordPress in it’s CMS incarnation, and much less to typical blogs.

  32. Shark says:

    If you want to change your permalink structure there is a good plugin which 301s all your old url’s with the new ones

    http://www.deanlee.cn/wordpres.....on-plugin/

  33. jeremyclarke says:

    Daring Fireball has a great article about designing permalinks carefully here.

    I use the standard y/m/d/title structure, though I have made use of post id’s in pretty urls when building sites that will be in other languages like Bangla, Arabic and Farsi, as titles in those languages create permalinks with raw UTF codes, which is VERY human-unfriendly.

  34. Schanie says:

    I have always preferred using custom permalinks with .html appended.
    what is the best solution to recover the search engine links if you change permalinks by design or otherwise

  35. patty says:

    Wow, lots of discussion here. I always preferred the post id style of permalinks, it seems short, sweet and simple, unlike some of the other styles that end up wrapping onto another line. Does it really make that much difference with the search engines anymore? I have several family history blogs that get a lot of search engine traffic and use the post ID permalink structure.

  36. Mark says:

    I use the ugly default. Longer names are bad in my opinion because some email programs won’t carry the link to pick up URL’s that wrap to another line. That’s a real concern when people email a link to a post.

  37. dustin says:

    Alright…I tried doing all this word for word and I can’t get anything to work. Not even the other preset ones from wordpress. I made a .htaccess file, but it didn’t work. I changed permissions to let wordpress do this, but again no luck. Forgive my ignorance, but my server is MySQL is that different than apache? I read the wordpress post about permalinks so many times, but when I make them apart from the default the pages don’t show up.

    Please help!
    Thanks
    Dustin

  38. Mateus says:

    Thanks for the post! You saved my life!

    My current webhosting not accept access to .htaccess, then the third alternative I was very useful thanks again.

  39. Brian Garvin says:

    Hello,

    Right now I’m trying to create a permalink structure
    for my WP Blog. I’m using C-Panel. Can anyone to the
    best of your ability give me step by step instructions
    on this? It was installed via Fantastico if that matters.

    I’m not finding the things many are referring to.

    Brian

    • Installing from Fantastico or the manual install show not have any differences regarding how to configure Permalinks. What is it that you can’t find?

  40. Brian Garvin says:

    Hello,

    I found it and got the permalinks working. In was in the settings area. But I’d like to find out how to change the link syntax. Right now for example when someone types in www [dot] domain [dot] com it automatically refreshes to domain.com and get rid of the www [dot]. I was wondering if there was a way to fix this or a little plugin script that would change this?

    Brian

    • WordPress 2.5 introduced conical URLs. In order to fix that mis configuration, make sure in the settings that the WordPress Address URL has the www.

  41. Brian Garvin says:

    Hi Jeff,

    It worked, thanks a ton. Not sure why I forgot the www.

    Brian Garvin

  42. Lluis says:

    hi!

    thank you for this very interesting article! I’ve learned a lot!

    But I still have a problem with the permalinks on my website…

    I have to use “the ugly ones” because it seems my server doesn’t support them. It’s that possible? If I set up the permalinks as any other structure “/%year%/%monthnum%/%day%/”, for example, and then load the url, the server responds with a message that says “Error: the url “domain.com/2008/11/01/” doesn’t exists on the server”…

    I’ve set up the htaccess file as you described and also I’ve included the “index.php/” prefix in the permalinks, but still does’nt work..

    What can I do?

    Thanks a lot!!

  43. hanselzen says:

    Thank you so much for this tips. My hosting disabled mod_rewrite and i was thinking to find another host but it solved now with your tips. Thans again.

  44. Alex says:

    I’ve been reading some articles recently saying that permalinks are redundant these days but I still use the standard ‘post-name’ type.

  45. josemalone says:

    I’m curious what your take is on this tidbit from WordPress about starting with a numerical field and not a text field for performance issues? Have you seen any hits on performance?

    For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. The reason is that these are text fields, and using them at the beginning of your permalink structure it takes more time for WordPress to distinguish your Post URLs from Page URLs (which always use the text “page slug” as the URL), and to compensate, WordPress stores a lot of extra information in its database (so much that sites with lots of Pages have experienced difficulties). So, it is best to start your permalink structure with a numeric field, such as the year or post ID.

  46. Dan says:

    Whatever permalink structure you choose, the archives create their own system index.php/category/title or index.php/tag/word

    I want to change this one too. How?

    Thks,
    Dan

  47. Meline says:

    OMG! Thank you so much for the tutorial!

    I been having this problem for like 2 days and I thot I the only way to solve it was to switch to Linux which most I heard.

    I was even gonna call my webhosting server.

    Thank you again!

  48. jefrey says:

    how safe is it to change perma links?i want to change http://pctechph.com/?page_id=124 tp http://pctechph.com/seotools

  49. Wsie says:

    Thank you very very much, i was working on this problem for whoe week. i have searched every blog. Finaly your idea helped me out.

    God bless you man

  50. Arjen says:

    Wauw, I thought I was an expert on this. Well, it seems that I have learned a lot of new permalink structures.

    Especially the hour/minute/second setting seems interesting for my website.



Trackbacks/Pingbacks

  1. […] este artigo do Jeffro2pt0 no site Weblog Tools Collection mais elaborado onde explica as várias opções que […]

  2. […] Press – Comprehensive URL Canonicalization via htaccess for WordPress-Powered Sites”, Weblog Tools Collection – Configuring WP Permalinks, and Mark Jaquith – WordPress 2.3: Canonical […]

  3. […] ???Weblog Tools Collection […]

  4. […] this plugin has a security issue, when its fixed I’ll reinstate the link. Thanks Miriam). 28. Configuring WP Permalinks. 29. WP User Manager. 30. WP Tags to Technorati […]

  5. […] Weblog tools Collection -Configuring WP Permalinks […]

  6. […] nos posibilita el uso de algo similar. Quizas muchos lo estén usando sin saberlo y otros como yo, lo desconocían. Pero me parece una idea genial y que todo el mundo debería tener la posibilidad de mejorar su SEO […]

  7. […] Configuring WP Permalinks- Weblog Tools Collection has a useful guide on setting up permalinks on your WordPress blog and how […]

  8. […] read a very comprehensive article about WordPress permalinks from Web Tool […]

  9. […] the entire site before settling on custom permalinks. If you need immediate help now I suggest Configuring WP Permalinks by Weblog Tools Collection. Add this to : Digg it Save to Del.icio.us Subscribe to […]

  10. […] reading: Configuring WP Permalinks by Weblog Tools Collection. Add this to : Digg it Save to Del.icio.us Subscribe to […]

  11. […] this plugin has a security issue, when its fixed I’ll reinstate the link. Thanks Miriam). 28. Configuring WP Permalinks. 29. WP User Manager. 30. WP Tags to Technorati […]

  12. […] this plugin has a security issue, when its fixed I’ll reinstate the link. Thanks Miriam). 28. Configuring WP Permalinks. 29. WP User Manager. 30. WP Tags to Technorati […]

Obviously Powered by WordPress. © 2003-2013

css.php