Time for action – setting up pretty permalinks

Setting up permalinks is simple and you do it in the WordPress admin.

  1. Go to Settings | Permalinks to view the screen shown in the following screenshot:
    Time for action – setting up pretty permalinks
  2. As you can see from the screenshot, our permalinks are set to Default, which is why they aren't very pretty. Click on the Post name radio button to change this, as shown in the following screenshot:
    Time for action – setting up pretty permalinks
  3. Click on the Save Changes button.

What just happened?

We made a quick change in the Permalinks Settings screen to configure pretty permalinks. Now let's see what the URL is for that post:

http://rachelmccollin.co.uk/opensourcemagazine/post-with-a-slightly-shorter-title-but-more-text/

That's better! It's much more descriptive—if a little long! The text after the URL for the site (that is, post-with-a-slightly-shorter-title-but-more-text is known as the slug ). You can edit the slug in the page or post editing screen when you're setting up your pages, which you might find helpful for user-friendliness or SEO.

Note

To find out how to change the slug, and therefore the URL, of individual pages and posts, see http://codex.wordpress.org/Pages#Changing_the_URL_of_Your_Pages.

Permalinks – a quick guide

You may have noticed that when you clicked on the Post name radio button on the Permalinks screen, the text /%postname%/ appeared in the Custom structure field below it. This is the tag which WordPress uses to generate the URL based on the post name. Other tags are:

  • %year% – the year the post was published using four digits, for example 2013.
  • %monthnum% – the numerical month the post was published, for example 05.
  • %day% – the day of the month the post was published, for example 28.
  • %hour% – the hour the post was published, using the 24-hour clock, for example 15.
  • %minute% – the minute of the hour the post was published, for example 43.
  • %second% – the second of the minute the post was published, for example 57.
  • %post_id% – the unique ID of the post, for example 7.
  • %postname% – the post name, using the slug which is automatically generated from the post name or which you can edit manually.
  • %category% – the slug for the category, which is either generated based on the category name or which you specify when setting up the category. For example, WordPress would give the slug new-products to a category called New Products.
  • %author% – the author name, for example Rachel McCollin would become rachel-mccollin.

    Note

    Occasionally permalink settings may not work right out of the box, as it depends on your server configuration. In some cases, you may have to change the file permissions for the .htaccess file at the root of your site. For more on this, see http://codex.wordpress.org/Using_Permalinks.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset