WordPress Tutorials

WordPress Permalinks: How To Set Them Properly?

WordPress Permalinks How To set them properly
Written by Raashid Din Dar

WordPress permalinks are the permanent addresses of your individual posts and pages.

Permalinks in WordPress play a crucial role in the SEO. If not set properly, you wouldn’t get much benefit from search engines.

You have to set them in a right way and make them pretty.

Why WordPress Permalinks are Important

Permalinks help in finding your piece of content. There is no blog which doesn’t have permalinks. It is through permalinks, humans and search engines find your blog.

Permalinks are the URLs of your blog posts and pages.

Why are they important?

  • Permalinks help in getting backlinks. e.g; if someone likes your content and he wants to point to your blog post in his/her blog, he will give backlink by embedding your post permalink or URL in his/her blog post.
  • Permalinks help search engines to find your blog post. It is through these URLs search engines index your blog post.
  • URLs or permalinks help in sharing the content on social media. You don’t post full article on social media but you post the URL through which the users reach you.

Problem with Default WordPress Permalinks Structure

By default, WordPress comes with an ugly URL structure.

Why WordPress doesn’t come with better URL structure?

The main reason behind not coming with better URL structure is that the default URL structure doesn’t require any special server or file setup.

You may have noticed the default URL structure, which looks like this.

default permalinks structure in wordpress

Whenever you create a WordPress post, a unique id of that post is created. That unique id is being used in the default URL structure.

The “?p” references to the posts and pages. After the equal sign, you will notice a unique id mainly numerical.

So the meaning of the default WordPress Permalinks or URLs is that “Retrieve the post or page with its id and display it”.

Is this Bad?

Let’s take an example to understand the badness of default WordPress Permalink structure.

Say, you published a post regarding WordPress with title of “What is WordPress?”.

By default, the WordPress will generate a unique id of that post and will create a URL just like this.

default permalinks structure in wordpress

When you submit the post to search engines or social media, no one knows regarding what the content is.

But, at the same time when you use pretty links, everyone will get a hint. Example of pretty link is.

So the pretty Permalinks structure enables you to optimise your post or page for both search engines as well as for humans.

Things you should know before setting Permalinks.

Before giving a new structure to your post or page permalinks, you must have some basic knowledge of it like where they are generated.

By knowing the basics, if something went wrong, you should be able to easily revert it to default settings.

Let’s start.

HTAccess

When you change or update URL structure, this file is created or updated respectively.

The HTAccess is basically a file starting with dot notation and looks like “.htaccess”.

This file exists in the root directory of your WordPress files.

Note: If you use cPanel, you may not see it. Files starting with dot notation are treated differently. Some hosts hide these kinds of files from view.

If you download the latest WordPress version, you wouldn’t see this file. Why? Because it is not part of code. It is used for the pretty Permalinks structure.

So to create a pretty permalink structure, you don’t have to create it manually but WordPress will do it for you.

Go to WordPress Permalinks settings and change the default, this file will be created.

Note: If you received this message while changing permalinks structure, ” Permalink structure updated”. This means WordPress has successfully generated the file otherwise not.

In rare cases, you may have to create this file manually. Don’t fear, we will show you later in this tutorial, how to create the file manually if WordPress is failing to create it?

Short URLs

Over the past few years, Short URLs have become popular. These URLs have few characters. They are useful because search engines love short URLs.

As they have proven useful, but they were also hazardous.

Bad guys use these types of short URLs and trick users and damage their privacy.

I am always against the use of short URLs generators like bit.ly.

You can shorten the URL length of post by own in wordpress. Instead of writing lengthy URL, you can edit it to create a short slug of post.

How to Set WordPress Permalinks Properly

In this section, we will discuss two things;

  • How to change default WordPress Permalink structure?
  • How to change Permalink of a post or page individually?

Let’s start with our first topic.

How to change default WordPress Permalink structure?

Changing the default URL structure in WordPress is pretty easy. Just navigate to Settings>>Permalinks. There you will notice different permalink structures at least 6 in number. Let’s dive into each one of them.

  • Plain: This is the default URL structure of WordPress.
  • Day and name: If you want to show the publish day and post name in URL, you can use this.
  • Month and Name: if you want to show the publishing month and post name as a URL, this is one is good then.
  • Numeric: This URL structure shows only post id without that “?p”.
  • Postname: This is the URL structure we are talking about. This structure is also called pretty URL structure. This is the recommended URL structure.
  • Custom Structure: If you don’t like any of the permalink format of the WordPress, you can define your own version (format) of the URLs.

So, we have chosen the “Postname” URL structure.

WordPress permalinks settings

This structure will help us a lot. For example, you can define own URL for specific page or post.

Once you select the option, hit the Save Settings button and wait until you receive “Permalink structure Updated” message.

How to change Permalink of a post or page individually?

Once you decide which permalink structure is in favour of your website, stick with it for life. Other bloggers use these URLs to point towards your blog. So it is advised not to change URL format regularly unless necessary.

Changing permalink format of an individual post or page is easy as holding a cup of coffee.

Once you write the title of a post, you will see a box under it.

Permalink settings box below post title

You can simply hit the Edit button and set your unique permalink for that post or page.

Individual permalinks settings for post or page in wordpress

It is recommended to set the permalink of post once. Don’t change it after you publish the post to search engines.

Because if you changed the structure, the users will see nothing except 404 page and search engines will find it difficult to reach the page.

How To Create .htaccess file manually?

In order to get the work done, let’s dirt our hands with some code.

Go to your websites root directory and create a file named as .htaccess. Inside the file, enter this code.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Save the file and visit any post. You will see the result of the work we just did.

Conclusion

I hope you learned everything about WordPress Permalinks. Before leaving the site, be sure to remember the below mentioned things.

  • Don’t change the permalink structure once you stick with one you chosed.
  • Don’t change the permalink of individual post or page once you hit publish button.
  • Don’t forget to comment and share.

About the author

Raashid Din Dar

Raashid Din Dar is a web developer and designer. He specialises in WordPress Theme and Plugin development. Also, Web Designing is what he loves.He loves to read books and play with friends.

Leave a Comment