The Complete Guide To WordPress Permalinks
Complete-Guide-To-WordPress-Permalinks

One seemingly minor aspect of WordPress you may not give much thought to is permalinks.
But although it seems like a small thing to worry about, permalinks can actually have a bigger affect on your site’s traffic and search engine rankings than you might think.
And ignoring them can be dangerous. Not only can bad permalinks have various negative effects, but they can be very difficult to change later on without taking the risk of completely breaking your site.

In this post, we’ll go over why permalinks are so important to your WordPress site, the pros and cons of different permalink structures, and how you can safely change them on an established site without breaking it.

What exactly are permalinks?

Permalinks are the URLs used to reach any page or post on your WordPress site.

For example, here are a few real examples of permalinks on this site:

As you can see, these permalinks are readable and give you a good idea of what you’ll get if you click the link.
Those nice, readable URLs are made possible by WordPress’s permalinks settings, accessible from the WordPress dashboard under the Settings > Permalinks menu option.
You’ve probably seen WordPress’s default URL structure around the web, though you may not have realized what you were looking at.

Here’s what those same posts might look like with WordPress’s bare, default URL system:

  • http://theme-paradise.com/?p=238
  • http://theme-paradise.com/?p=93
  • http://theme-paradise.com/?p=465

Not so pretty, right? You have no idea what you’re getting into when you click that link — it could be anything.

Why are permalinks important?

Sure, permalinks with words look much nicer than the default ID numbers.
But are they really that important?
Actually, permalinks can affect a lot of things on your site:

  • A good permalink structure can boost your search engine rankings. According to Moz, the more readable your URLs are by human beings, the better. Also, your URL might be used by itself as anchor text for a link, so a more descriptive URL with keywords may boost your rankings that way.
  • Permalinks can affect a reader’s decision whether or not to click links to your site. URLs show up when a user hovers over a link, and they’re listed in search results as well. Using descriptive keywords in your URLs will give people an idea of what they’ll get when they click on your link. A readable URL will generally get more clicks than an unreadable or ambiguous one, which can look spammy.
  • Good permalinks improve your site’s usability. A good permalink system that reflects your website’s structure will help your users to understand where they are and navigate your site more effectively. For example, a URL like www.example.com/furniture/desks/ lets visitors know that your site doesn’t just have desks for sale, but likely other furniture categories as well.

Which permalink structure should you use?

If you navigate from your WordPress dashboard to Settings > Permalinks, you’ll see that WordPress suggests a few options for your permalink structure besides the default:

  • Day and name: example.com/2015/06/25/sample-post/
  • Month and name: example.com/2015/06/sample-post/
  • Numeric: example.com/archives/123/
  • Post name: example.com/sample-post/

You can also enter your own custom permalink structure using one of the structure tags listed in the codex.

In most cases, using the post name, or the category and post name, is ideal, since it’s the most descriptive of the content.

But we’ll take a look at some of the pros and cons of each structure so you can decide which is right for your site.

Day and name, or month and name (/2015/06/sample-post/)

Pros: If you have a news site and the date is relevant to your post content, including it in the URL can be beneficial to your users. Or, if you have a large site and post multiple times a day, it may be helpful to sort those posts by date if it’s relevant to the content.

Cons: There’s usually no good reason to include the post date in your permalinks, especially if your blog posts tend to be more evergreen. If your potential visitors see that your content is older they may decide to look elsewhere, even if your content is still relevant and useful.

And, while having a date in the URL may not hurt your site, shorter URLs tend to get more clicks, so why include information that’s not necessary?

Numeric (/archives/123)

Pros: There really isn’t any advantage to this structure over the default, though it does look a little better than having a question mark, which may confuse readers.

Cons: A post number in the URL doesn’t give your potential visitors any information about the content of the link, and doesn’t give you any SEO benefits either.

Post name (/sample-post/)

Pros: Using your post names as your permalink structure has a lot of benefits. Your post titles should already be reflective of your content and use any keywords you’re targeting, so having the title in the URL is an effective way to let potential readers know what they’re clicking on, and get the most SEO benefits out of your permalinks.

Cons: If you use very long post titles, your URLs might get ungainly. If that’s the case for you, you can always edit the permalink for each post before you publish it. Right under the title field, the permalink will be displayed. Just click “Edit” to shorten it if necessary. About 3-5 words is ideal according to Matt Cutts.

Category and post name (category/sample-post)

Note: Since this isn’t one of the suggested options, you’ll have to choose “Custom Structure” and enter “/%category%/%postname%/” (without the quotes) into the field.

Pros: This option has all the benefits of using the post name, but including the category also allows you to add more information and keywords into your permalinks. This is a great option if you have a lot of content and want to give your permalinks more structure, or get more SEO benefits by including more keywords in your URLs.

Cons: Using categories may make your URLs too long if your post titles tend to be long as well. If you don’t have a lot of content, or if your blog is already on a very narrow niche and your categories don’t differentiate much, then you probably don’t need to include them in your permalinks.

The most important drawback to using categories in your permalinks, however, is that it really restricts your use of categories. You can’t change them, or move posts between categories, without risking breaking your links.

What about pages or custom post types?

Under the Permalink Settings menu, WordPress only gives you the option to change your permalink structure for posts, but that doesn’t mean you can’t customize the structure for pages or custom post types as well.

By default, page permalinks are assigned according to their hierarchy. So any top-level parent page will have the simple URL structure of www.example.com/parent-page, while a child page would be www.example.com/parent-page/child-page.

If you want to change that structure, or if you use custom post types on your site and want to change your permalink structure, WordPress doesn’t make it easy out of the box. However, we have a tutorial on changing custom post type permalinks using the Caldera URL Builder plugin, which makes it much faster and easier.

How to change your permalinks without breaking your site

“Permalinks” is actually short for “permanent links,” and they’re called that for a reason.

Each post’s permalink is supposed to be its permanent address on the web. Anyone at anytime should be able to type it in and reach your page.

Changing the permalinks on an existing site is like moving without leaving a forwarding address.

Anyone that clicks a link across the web that points to your posts — whether on social media, other websites, or within your own site — will end up on a 404 error page. All these broken links can also have a huge impact on your search engine rankings, since Google uses links as a strong signal to determine your rankings.

There are steps you can take to prevent this, but they can be a lot of work. So before you change your permalink structure, ask yourself if it’s really necessary. There are plenty of other ways you can boost your search engine rankings without restructuring your entire site, so consider whether taking the risk of breaking your site, and putting the time and effort into changing everything, is really worth it.

If you decide you do need to change them, you’ll need to set all the old permalinks to redirect to the new permalinks.

Don’t worry, you don’t need to change every link across the web that points to your website! You can actually do it on your own website by using a 301 redirect. A 301 redirect tells any browser visiting your site that the page has moved to a new permanent location, and redirects any visitors from the old URL to the new one automatically.

You can set your own 301 redirects manually by adding some code to your .htaccess file, a kind of server configuration file that’s in the main directory of your website (not exclusive to WordPress).

Alternatively, you can use a plugin like Simple 301 Redirects.

We’ll go over both methods below.

(Remember, it’s always a good idea to backup your site before making any major changes just in case.)

Option 1: Change your permalinks to post names using htaccess

Step 1: Get your redirect code ready

Use Yoast’s Create Redirects tool to generate the necessary code to redirect all your posts.

You’ll get a line of code that looks something like this:

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www.example.com/$3

Step 2: Locate and backup your .htaccess file

Your .htaccess file will be located in the main directory of your website (e.g. www.example.com). You can access the file using an FTP tool like Filezilla, or by logging into to your web hosting account dashboard and opening up the File Manager tool.

Backup the file by creating a copy you can use to replace the file if anything goes wrong.

Step 3: Change your permalinks in WordPress

Log in to the WordPress dashboard and go to Settings > Permalinks. Select “Post Name” and click “Save Changes.”

Step 4: Edit your .htaccess file

Open up your .htaccess file and paste in the code at the top of the document on a new line. Save the file. (Keep your file manager or FTP software open through the next few steps, just in case.)

Step 5: Test your redirects

Go to your website and make sure it’s working. (If it’s not, restore your .htaccess file from the backup you made, make sure your site is back up again, and try starting over from the first step.)

Now test some of your old links to make sure they’re redirecting correctly to the new permalinks.

Option 2: Use the Simple 301 Redirects Plugin

Step 1: Install Simple 301 Redirects

Download and install the Simple 301 Redirects plugin.

Step 2: Change your permalinks

Navigate to Settings > Permalinks, and select the new structure you want.

Step 3: Set up your redirects

Go to the new menu option Settings > 301 Redirects.

In the “Request” field, enter your old permalink tags (for example, “/%year%/%monthnum%/%postname%/” without the quotes).

In the Destination field, enter your new permalink tags (for example, “/%category%/%postname%/” without the quotes).

Make sure both of your tags begin and end with a forward slash:

Click “Save Changes.”

Step 4: Test your site

Now make sure your website is working, and test your old post links to make sure they redirect to the correct new permalinks. If it’s not working, make sure the tags entered in to the Simple 301 Redirects menu are 100% accurate.

Conclusion

Permalinks are easy to take for granted, but next time you decide whether or not to click a link — whether in search results, on social media, or just surfing the web — pay attention to how the URL the link is pointing to affects your decision. They’re a lot more influential than you think!

What permalink structure do you use for your site, and why? Have you ever had to change the structure before? Share your experiences in the comments below!

Leave a Comment