How to create the perfect blog URL permalink structure in WordPress (with examples)

  • Home
  • >
  • Articles
  • >
  • Tutorials
  • >
  • How to create the perfect blog URL permalink structure in WordPress (with examples)
The Perfect Blog URL Structure

Ah, the holy grail of my WordPress journey that spans more than 7 years…

How to create the perfect blog URL structure, that appeals to my sense of order.

And I finally discovered the last piece of the puzzle.

So it’s time to lay out my entire solution for you, so you can emulate my juicy set-up.

I’m super tickled to finally have it nailed!

What does the ideal WordPress blog URL structure look like?

Since I started using WordPress back in January 2013, I have been searching for the best permalink structure to use for my websites, to allow me to have nice neat URLs, and a sensible URL structure, while retaining flexibility.

There are three key pieces to this challenge:

  1. The URL for the Posts Page (i.e. your blog home page – the page that displays all of your posts), set in the page slug (and indirectly via the Reading Settings page)
  2. The URL for the Category Archive pages (i.e. the page that displays all posts in a specific category), set via the Permalink Settings page
  3. The URL for an individual Blog Post, set via the Permalink Settings page

The ideal solution needed to have, for my purposes:

  • Neatly organised URLs
  • The ability to separate out the performance of the blog content in a way that makes sense
  • The ability to move posts between categories without causing issues
  • Pagination that works on all pages that list blog posts
  • No 404 errors
  • Ideal behaviour for SEO

And although I’ve figured out pieces of this in the past, I finally cracked the entire puzzle.

How to create the best WordPress permalink structure

I’m going to take you through each option in turn, so you can decide which approach will work best for your situation.

But before I do, some important notes:

  1. Never EVER change your permalink structure on a live site lightly. If you decide to make changes to an existing structure with live content, make sure to 301 redirect your old URLs to your new ones to avoid broken links and SEO damage.
  2. Always remember to reload or save your permalinks settings page any time you make a change to your settings, to force WordPress to flush the permalink cache. Otherwise, you’ll get weird errors, and think it’s not working, and chase your tail for hours.

I warned you!

Now that that’s out of the way, here’s some options for you to create a splendidly satisfying blog permalink structure on your WordPress website.

Option 1 – Use the category base

This is the default pemalink set-up for many sites, and looks something like this:

Page Solution URL Example
Posts Page Use an unrelated page
i.e. Posts Page slug = blog
/blog/
Category Archives Use a category base
i.e. Category base =  category or something similar
/category/tutorials/
Blog Post Use either nothing or the category

  1. Custom structure = /%postname%/
  2. Custom structure =/%category%/%postname%/
 

  1. /my-blog-post/
  2. /tutorials/my-blog-post/

Overall, I don’t like this set-up because the URLs are all so unrelated. I want all my blog content related pages to live in a section of my site, and for the URLs to reflect that.

For an individual Blog Post, the first option might be OK for a small site at the start, but you quickly realise as your site grows, that having your posts at the root of the site makes for messy organisation of your content and muddy analysis of your site performance (e.g. in Google Analytics).

Trust me, I’ve been there!

The second option is also not great because it doesn’t match the Category Achives URL permalinks or the Posts Page URL, and doesn’t explicitly allow me to know that this content is part of the blog.

And what if I want to change the category of a post later on? This would change the URL of the blog post, requiring redirections to avoid broken links and SEO headaches, which I don’t want to have to deal with.

(I’m fickle, OK? I like to reorganise my blog content regularly, especially as it grows, and I discover new topics or types of content I want to create.)

Nope, I need more flexibility than this and much less of a mess of URLs.

Option 2 – Overlap directory names / slugs

This option involves using the same slug for the Posts Page, Category Archives and individual Blog Posts.

Page Solution URL Example
Posts Page Use an unrelated page
i.e. Posts Page slug = blog
/blog/
Category Archives Use a category base
i.e Category base = blog
/blog/tutorials/
Blog Post Use the category base plus the category,
or just the category base

  1. Custom structure =/blog/%category%/%postname%/
  2. Custom structure = /blog/%postname%/
 

  1. /blog/tutorials/my-blog-post/
  2. /blog/my-blog-post/

While this seems like a super-neat solution overall, using the same slug for the Blog Posts, Posts Page and Category Archives causes conflicts, and fair enough.

I can successfully overlap the Posts Page slug and the individual Blog Post slug e.g. /blog/ and /blog/my-blog-post/

And I can also successfully overlap the Category Archives and the Posts Page e.g. /blog/ and /blog/tutorials/

But I can’t use the same slug for the Category Archives base and the individual Blog Post URL e.g. /blog/tutorials/ and /blog/my-blog-post/

Which kind of makes sense, due to the way that WordPress templates work – when it tries to load, for example, the /blog/tutorials/ URL , which template and content should it use – is it a Category Archive or is it a single Blog Post?

In truth, I could probably make this work if I spent the time figuring out how to do this in PHP, but honestly I can’t be bothered and I found a much simpler solution (below) that comes close to these neat URLs, without requiring much, if any, code.

And with regards to the blog post permalinks, although the first URL option more closely matches the Category Archive page URL structure, it doesn’t work so well if I want to change the category of a blog post down the track (which I often do).

So the second option for individual blog posts seems to be the best here, because it means that all posts live in the same sub-directory, regardless of their category, leaving me free to move posts between categories down the track, without having to worry about changing URLs, adding redirects and SEO issues. It also matches the Posts Page URL.

Of course, the fact that the Blog Posts clash with the Category Archive pages is a bit of an issue!

So I’m starting to get the flexibility I need for my blog posts, but I found an even better way, that actually works.

Option 3 – Use singular and plural slugs (Version 1)

This trick (and the next one) takes advantage of the fact that you can use very similar-looking slugs to overcome the above conflicts, but still create the same flexibility and mostly consistent URLs I’m looking for.

Page Solution URL Example
Posts Page Use a plural slug
i.e. Posts Page slug = blogs
/blog/
Category Archives Use a category base that’s the same as the Posts Page
i.e Category base = blogs
/blogs/tutorials/
Blog Post Use the the Posts Page slug as the base
i.e. Custom structure = /blog/%postname%/
/blog/my-blog-post/

So this solution puts your Posts Page and individual Blog Posts in the same subdirectory, with your Category Archives in their own similar but unique directory.

It keeps the flexibility of the individual page post URL from Option 2 ( above), while removing the conflict between the category base and the individual post base.

Note: You can also use “article” and “articles” in place of “blog” and “blogs”, which I actually prefer.

Just make sure to choose something that makes sense in both plural and singular forms.

You can also swap the singular and plural forms, just as long as the Category Archive slug (i.e. the category base) is the unique one.

Other great possibilities include:

  • post and posts
  • update and updates
  • story and stories
  • item and items
  • essay and essays
  • piece and pieces

You get the idea.

This permalink structure option improves on Option 2, because it brings the Category Archive permalinks closer to the URL structure of the other two content types, without causing any conflicts or 404 errors.

And if you’re happy with this set-up, then there’s nothing more you need to do.

You’ve created flexibility and reasonable consistency in the URL permalinks of your posts and archive pages, without touching a single line of code.

But if you’re like me, this may not sit quite right, and instead you want your Posts Page and your Category Archives in the same directory.

If that’s you, then read on…

Option 4 – Use singular and plural slugs (Version 2)

Drawing on the above solution, we still use singular and plural slugs to create consistency in our URL structure.

Page Solution URL Example
Posts Page Use a plural slug
i.e. Posts Page slug = blogs
/blogs/
Category Archives Use a category base that’s the same as the Posts Page
i.e Category base = blogs
/blogs/tutorials/
Blog Post Use the singular version of the above slug
i.e. Custom structure = /blog/%postname%/
/blog/my-blog-post/

But this time, it’s the Posts Page and the Category Archives that share the same base, while the individual Blog Posts have the unique URL.

I personally prefer this structure for a couple of reasons:

  • It groups the pages that display lists of posts (ie the Posts Page and the Category Archives), which are similar kinds of content
  • It separates these list pages from the individual Blog Posts, which are a quite different kind of content from list pages, for reporting and analysis purposes
  • It just makes sense to me – lists are plural, blog posts are singular

And in fact, my preferred terms are “articles” and “article”, so the lists pages are lists of articles and the Blog Posts are an instance of an individual article.

So now we have a lovely URL structure, with permalinks that make sense, and we’ve yet to touch a line of code.

And this is the permalink structure I’ve been using for years.

Except that there’s one teeny tiny issue with this configuration…

When you try to use numeric pagination on your Posts Page, and WordPress tries to load, for example /blogs/page/2/, it doesn’t know what to do, because it shares the same base slug as the Category Archives, it gets confused about what to load and returns a “Page Not Found” error.

Aaaaargh!

In the past, I’ve worked around this by either:

  • Listing ALL posts on the Posts Page – i.e. there’s no limit on the post displayed on this page, which is terrible for page load speed once you have lots and lots of posts
  • Using infinite scroll or “load more” type pagination – I don’t think this is great for SEO purposes, and I want to make sure that ALL of my blog posts can be easily crawled by spiders

But I finally figured out how to make numeric pagination work on the Posts Page, with a small amount of code.

Pagination for the blog posts page

This solution is only required when your Page Posts slug and your category base are the same, which is generally my preferred configuration.

You’ll need to add this to your theme’s function.php file or to a separate custom plugin, that should never be deactivated.

If this code is removed from your site, what will happen is that your main Posts Page will generate a 404 error if you (or a search engine bot) try to navigate to the next page of posts.

And because you’re updating your permalink structure, make sure to reload or save your permalinks settings page every time you make a change so that WordPress flushes the permalink cache and your URLs work correctly.

Trust me, do not forget to do this! Every. Single. Time.

I adapted this code, as all good programmers do, from a Stack Overflow post, so thanks to Milo for giving me the final piece.

function nhs_fix_blog_pagination(){
	add_rewrite_rule(
		'blogs/page/([0-9]+)/?$',
		'index.php?pagename=blogs&paged=$matches[1]',
		'top'
	);
}
add_action( 'init', 'nhs_fix_blog_pagination' );

or if you’re using “articles” and “article” like I am:

function nhs_fix_blog_pagination(){
	add_rewrite_rule(
		'articles/page/([0-9]+)/?$',
		'index.php?pagename=articles&paged=$matches[1]',
		'top'
	);
}
add_action( 'init', 'nhs_fix_blog_pagination' );

So basically, whatever slug you’re using for your Posts Page and Category Archives, needs to be substituted in two places in the code above – Line 3 and Line 4.

This code allows my Posts Page to correctly paginate, and I’ve finally achieved my nirvana of blog URL structure.

I haven’t tested this solution in combination with my solution for changing the permalink URL structure for one specific post category, because this was for two very different sites and purposes, but if I ever do, I’ll let you know!

I also suspect that a solution along these lines might be the answer to using Option 2 (with all the same slugs), but I’m not going to spend the time exploring that right now.

Bonus Option – Strip the category base

On one of my other sites, I’ve actually used the “remove category base” option in the Yoast SEO plugin to create a very different URL structure.

There are other plugins you can use for this as well, and you can also do this using code via your functions.php file, by setting your category base to ‘.’ or by using htaccess rewrite rules, but some of these solutions still show the unmodified URLs in the code of your site, which I absolutely and categorically HATE.

Page Solution URL Example
Posts Page Don’t use a page for this at all N/A
Category Archives Use  the default category base (which is then stripped)
i.e Category base = ” (an empty string) which means it will be set to “category”
/tutorials/
Blog Post Use the category without the base
i.e. Custom structure = /%category%/%postname%/
/tutorials/my-blog-post/

In this instance, I’ve used the post categories to create sub-folders for each of the distinctly different types of content on this site.

This works for this particular site because it’s very blog post heavy and has relatively few static content pages (and it’s unlikely to need many more), so I wanted to design something around my broad topics on my site across my hundreds of posts.

However, this permalink structure doesn’t have the same flexibility to move content between categories without creating broken links and SEO issues as the above solutions, so it’s best for a site where your content categories are very clear in advance and there’s little to no chance you’ll ever want to reclassify a post.

With this structure, you may also want to create custom templates for each post category, so you can have more control over the “landing pages” for each of these content categories.

You can of course choose to create a Posts Page that lists all of your blog posts, but it doesn’t really make sense when you have such clear delineations for your post categories.

The other (minor) downside of this approach is that it does rely on a plugin (or custom code) to strip out the category base from your URLs, so there’s more overhead and you need to be careful that this never gets deactivated on your site as well, lest it create utter chaos on your site.

And then sometimes there’s also the crappy unmodified URLs showing up in the code of your page. Huff.

Some caveats to all of this

These solutions are really only intended for blogs with relatively simple structures, and may not work as expected with more complex set-ups.

Sub-categories

For example, if you make use of sub-categories, WordPress may not be able to tell between a post in a parent category and a sub-category under the same parent category.

You can avoid some of these issues by making judicious use of the “primary” category value, but there’s so many different ways you could use this that it’s impossible to fully explore it here.

URLs for feeds

Any time you’re messing with post permalinks, there’s a chance you will also mess up your RSS feed URLs.

Case in point, my solution for modifying the permalink of one category has exactly this issue, which I’ve yet to spend the time to solve.

I’m sure these kinds of issues can be addressed with appropriate rewrite rules, but I’m not ready to get in that deep just quite yet.

Alternate solutions

There are some other suggested solutions out there, e.g. for Option 2, that didn’t work for me but might work for you.

So if none of the above options suits what you’re trying to create, keep exploring what’s out there, and keep testing (preferably on a dev site) until you find something that works for your particular situation.

I would also recommend crawling your new structure with something like Screaming Frog to find any issues, unexpected behaviour or broken URLs before going live with it.

Time to create the perfect permalink structure for your WordPress site?

So now you have a multitude of ways to create a beautiful blog URL permalink structure to suit whatever you want to do with your blog.

No matter which way you choose, it’s nice to know that you now have more control over the appearance of your blog URLs, in some instances without even requiring any code.

Please leave any comments or suggestions below and have fun creating your perfect blog URL permalinks!

Please share this content

About the author 

I’ve had a love affair with systems, technology and data for as long as I can remember. I’ve been building websites for over 20 years, running online businesses for more than 15, and teaching myself how to use gazillions of software programs since the very first moment I got my hands on a computer. I’m a geek and proud of it!

  • Great, well thought out, well-written article! It helped me a lot and I’ve been working with WordPress for over 15 years. Very appreciated!

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
    >