As you may already know every page and post in WordPress has a unique URL which is used to access and read the contents of that post. The other fancy name for a URL is permalink which means permanent link because the URL once given to a post should remain permanent.

Visitors can bookmark permalinks for later use, share on their social profiles and link to them from their own content.

What are WordPress permalinks?

WordPress permalinks by default are a bunch of numbers and dashes also known as ugly URLs. If you make a post in WordPress and see it’s URL, it will be like, for example http://learningcms.com/?p=123.

From where that p=123 comes from is basically the post ID number in your WordPress database wp_posts table.

WordPress will keep on increment these numbers for the posts you make. Although this functionality assures there will be no two posts with the same URL but the default URL structure lacks human readability and other issues discussed in next section.

bad permalinks in wordpress

Why change permalinks in WordPress?

The default permalink structure in WordPress is neither user-friendly nor SEO friendly and that’s why you should change it.

Which one of the following two URLs make more sense to you?

http://xyz.com/?p=123 or http://xyz.com/wordpress-tutorial

The latter one is also called a pretty link which is certainly more obvious giving more clues about the article’s content. It will get more shares results in more traffic.

The keywords in the pretty permalink will make it even more SEO friendly and make search engines job easier to crawl and index your pages.

How to change/update permalinks in WordPress?

Now you know why pretty permalinks are important, it’s time to change WordPress ugly URLs to pretty permalinks.

  • From your WordPress dashboard, go to Settings > Permalinks.

wordpress permalinks menu

  • Under Permalink Settings, there are five different URL structures to choose from. You can even see an example in front of each option on how the permalink structure will look like once you will apply it.

wordpress permalink settings

  • Day and name: Choose this URL structure if you are an aggresive blogger and make posts on daily basis.
  • Month and name: Choose this one if you make few monthly posts.
  • Post name: Choose this URL structure if you are not interested in WordPress blogging functionality and want WordPress to look more like a “website” with few pages.

Anyway these are not rules and you can choose anyone you like. For example at learningcms.com, we are using Post name as our URL structure even though we hosts a WordPress blog.

What is WordPress Custom Permalinks?

5th option in Permalink Settings page is Custom Structure which can be used to define your own pretty permalinks in WordPress. You can use any of the following most common Structure tags:

  • %year% – specifies the year the article was first published.
  • %monthnum% – specifies the month the article was published.
  • %day% – specifies the day the article was published.
  • %post_id% – post ID number of your post.
  • %postname% – it will show the post slug of your post.
  • %category% – category of a post.

For example a custom structure %post_id%-%postname% will finally generate learningcms.com/123-postslug.

post slug means the last part of your permalink usually post title.

Woopoo's Tip

A less used tags include:

  • %hour% – hour the article was published.
  • %minute% – minute the article was published.
  • %second% – second the article was published.
  • %author% – add author name in WordPress permalink.

Where permalinks are stored in database?

Pretty permalinks in WordPress are not stored anywhere in database. Instead WordPress uses web server’s modules to generate permalinks on the fly, for example Apache mod_rewrite module.

.htaccess located on your web server is the file which will make this happen. More about it later in this tutorial.

How to fix common Permalink errors in WordPress?

Setting permalinks in WordPress should be one of the first things you do after installing WordPress but anyway it’s never too late to do anything good to your blog. If you are doing it now, there could be consequences but there are solutions too.

Permalinks not working

Before making any changes to permalinks, make sure .htaccess file is writable otherwise permalink settings will not work. WordPress adds URL rewrite code to .htaccess file to let permalinks work properly.

htaccess preview wordpress

See how to find and use .htaccess file in WordPress for more details.

You can set permissions for .htaccess file either in CPanel or using your website FTP account. The permissions should be 644.

htaccess file permissions

 

See .htaccess file in the root directory of your WordPress installation.

Woopoo's Tip

Remove index.php from permalinks

WordPress uses the term “Almost Pretty” for the URLs with index.php in them. To remove the words, do it either from custom structure or choosing any of the other “pretty” URL options as described above.

Broken permalinks

If you have setup your pretty links just now and you have a good chunk of articles, all of your internal linking of articles may break because the url structure has been updated.

You can fix the text links manually if you have fewer articles but to fix the issue on a large scale, see our article how to bulk change WordPress URLs.

Lost social shares

Yes! if your awesome articles has been shared among your social community, anyone clicking those links will return 404 page error “Page Not Found”. Reason, of course, the social link is pointing to article’s old URL but you have updated the article’s URL on your blog with a pretty permalink.

The solution is to use 301 redirect in WordPress to save your link juice.

We are done with our WordPress permalink settings guide. Setting pretty permalinks is an important step to optimize your blog for search engine optimization and to make it more user-friendly.

If you still have any questions do let us know using the comments section below and don’t forget to follow us on Twitter and Facebook

Gimme a Share pleeeaase!

Pin It on Pinterest

Share This