define('DISABLE_WP_CRON', 'true'); Better Permalink URLs For Your WordPress Blog - HTNet

Better Permalink URLs For Your WordPress Blog

If you’re hosting your WordPress blog on a mod_rewrite-enabled Apache web server, you can use this feature to make your post URLs prettier.

By default, WordPress uses an ugly format like http://yoursite/?p=795 (this URL is for post #795, just in case you’re wondering). If your server has mod_rewrite enabled, you can also use more descriptive URLs as suggested by WordPress:

WordPress permalink options

As you can see, I’m using a custom permalink structure defined as /%post_id%/%postname%/; therefore the URL for this post is: where %post_id% represents the unique ID number for the post and %postname% represents the sanitized version of the post title.

Those percentage sign sandwiched words you see above are what WordPress calls Structure Tags. From that linked page, you can find more structure tags that you can use to form nicer post URLs.

Here are some sample custom post URL structures you can use (along with the sample resulting URLs):

  • /%category%/%postname%/ results in: http://yoursite/the-category-slug/title-of-post/
  • /%postname%.html results in: http://yoursite/title-of-post.html
  • /%post_id%-%postname%.php results in: http://yoursite/123-title-of-post.php

As you can see, you are not limited to using slashes to separate the structure tags. You can also append extensions such as .html and .php in your post URL structure. I prefer to have the post ID appear in the URL so I can immediately use SQL queries to modify the post data if the need arises.

So if you’re starting a new blog (or helping someone setup theirs), try to make use of the custom post URL structure function. It’s quite boring to see a lot of blogs still using either the ugly URL structure or the very common date based URLs. Use this guide and your creativity to make your own unique post URLs!

Only one response to “Better Permalink URLs For Your WordPress Blog” so far.

  1. Brian Says:


    Thanks for the guidance in this article. Now I have a related question.

    How can I get rid of the “Posts Tagged As XXX” line off the page?

    This would be a great help!