How to Edit a URL Slug in WordPress

Updated 10 Aug, 2023 | SEO

A step-by-step process for using Yoast SEO or Rank Math to specify or edit URLs

URLs are a basic element of SEO and they’re incredibly important. In fact, various aspects of URL construction are in the top 200 factors that affect how high your content will rank in the SERPs:

  • URL length — shorter URLs are better
  • URL path — content that’s closer to your homepage may get a slight boost over pages that are many levels away from your homepage
  • URL keywords — keywords in your URL help search engines determine how relevant your page is to a given search term; it is a small ranking factor, however.
  • URL string — the categories included in your URL can help search engines determine what your content is about

While you have little control over much of your contents’ URLs once your website and content strategy are set up, you can easily optimise the URL slug for every piece of content you post on your website. If you’re using WordPress, Rank Math and Yoast SEO make modifying the default URL slug easy. You can either read the text below or listen to the audio.

Rank Math and Yoast SEO

Ok. First things first. Let’s make sure you’ve got the right plugin.

Rank Math and Yoast SEO are two of many plugins you can use to specify SEO particulars like the URL slug. Both are highly popular. If you haven’t installed one, go and do that now (the free version of each is more than adequate for this task). Here’s a good set of instructions that will guide you through installing and setting up Yoast SEO. Rank Math has a wonderful in-built wizard that will do the same.

While Yoast SEO and Rank Math are both easy to use and effective, I recommend Rank Math as it offers several very useful features in the free version that are only in the paid version of Yoast. The caveat section of this guide includes a very good example of this difference.

What is a URL slug? And why should you modify the default URL slug?

I know you probably just want to know how to change the default URL slug that WordPress generates for your content. But while it’s easy to do, I also know it’s easier to just upload a new webpage or blog post and not bother with changing the slug. So, before I teach you how to modify your slugs, I want to make sure you know how important it is so you don’t skip this vital step.

So, what is the URL slug? The slug is everything between the last two slashes ‘/‘ in a URL. To illustrate this, let’s take a look at a URL from my blog post SEO strategy — Wade’s hierarchy of SEO techniques and needs for better SEO ROI. The full URL is So the slug for this URL is ‘seo-strategy-wades-hierarchy’. Depending on your site structure, you might have additional slashes in your URLs. Here’s an example to help you in that situation: my packages page has the following URL The slug for that URL is ‘digital-marketing-packages-content-marketing-packages’ not ‘services/digital-marketing-packages-content-marketing-packages’.

As you can see, the slug you choose for a blog post can have a big impact on some of the URL-related ranking factors that Google looks at. If you’re not careful, it can drastically lengthen your URL. But on the other hand, it’s often your only opportunity to include a keyword in your URL.

In addition, the URL slugs you choose for your content can influence the behaviour of your prospects because a relevant URL helps people determine whether a piece of content is right for their needs. For instance, when someone googles something, they will often evaluate the relevance of the URL displayed in search ads to ensure the advertised web page is relevant to their search query. Similarly, when people in your target market see your content on social media, they will often look at the URL of the content before clicking through to read/consume it to check whether the content is likely to meet their expectations. The URL slug is your best opportunity to help these people realise that your content is relevant to their needs.

So, hopefully, you now know how important your URL slug is.

So why do you need to modify the default one that’s generated by WordPress? Well, WordPress’s default URL slug is just the title of your content. Sometimes that will be fine. But if we go back to our example blog post, you can see that some default URL slugs are just plain inappropriate. Having a URL that looks like this would not be a good idea because it’s really long:

So, while the default URL slug that WordPress generates should contain your primary keyword (because your content’s title should contain that), it will often be long enough that it could negatively impact your rankings in the SERPs. As a result, I recommend you always change the default slug if the title of your content is more than 3-5 words long. (Note, I’m referring to your page title, not your SEO title.)

URL slug best practice: What makes a good URL slug?

To make the best contribution to your ranking in the SERPs, URL slug best practice dictates that your URL slugs should ideally:

  • Be short. According to Neil Patel, the average number of characters in URLs in the top 10 positions in the SERPs is 50-62. That’s the number of characters in the full URL, not just the slug. Google has also confirmed that too many words in a URL will hurt your rankings. So the number of words you can ‘safely’ include in your slugs will depend on your domain names and URL path but shorter is better. In case you’re wondering, the URL in our example has 60 characters.
  • Be easy to read. As with all aspects of SEO, your URL slugs should make sense to the people you want to visit your content — your target market. When someone from your target market reads the URL of your content, they should be able to tell whether that piece of content is likely to be relevant to their needs. If they can’t, they’ll be much less likely to click through to consume your content. And if it looks like nonsense, they may even think your URL links to a virus. I’m guessing you don’t want your brand associated with viruses. The words in your slugs should be separated by hyphens ‘-‘ as in our example. Don’t run them together or separate them with underscores. (Google prefers hyphens.) It’s ok to include ‘stop words’ (a, the, but etc.) if that makes your slugs more readable.
  • Contain only lowercase characters. Microsoft servers will generally show uppercase slugs but many Unix ones will display a 404 ‘not found’ error instead.
  • Include your primary SEO keyword. Including your primary keyword in your URL slug will tell people and search engines what your content is about. If you can include your keyword near the beginning of your slug, that’s even better. You could also include a second keyword if you have room.
  • Contain only letters, numbers and hyphens. Some other characters can be included or encoded but this is usually unnecessary and just introduces opportunities for mistakes.If that sounds like too much work, an SEO writer can write your slugs for you.

How to use Yoast SEO to change the default URL slug

Ok. Now that you’ve got your slug, how do you tell WordPress that out want to use yours rather than their default one? That’s where Yoast SEO comes in. Just follow these simple steps:

  1. Open your page or blog post.
  2. Click on the Yoast SEO icon to open the SEO sidebar. OR Scroll to the bottom of your content until you find the SEO section.
  3. Open the snippet editor and locate the ‘slug’ field
  4. Enter your desired slug.
  5. Save your page (or publish it if you’re ready to publish it).

And that’s it. Pretty easy right?

How to use Rank Math to change the default URL slug

The process for editing the default URL slug in Rank Math is pretty much the same as for Yoast SEO.

  1. Open your page or blog post.
  2. Click on the Rank Math icon to open the SEO sidebar. 
  3. Open the snippet editor and locate the ‘slug’ field
  4. Enter your desired slug.
  5. Save your page (or publish it if you’re ready to publish it).

And that’s it. Pretty easy right?

How to edit URL slug in Rank Math.

Important caveat: Changing URL slugs on existing content

So changing the URL slug of a piece of content is really easy with Rank Math and Yoast SEO and the above five steps are all you need to follow if you’re modifying the URL slug on a new piece of content. If you’re changing the URL slug on a piece of existing content, there’s one more thing you need to do.

You need to redirect traffic from the old URL.

Redirecting traffic means all the people (and the search engine crawlers too) who visit your old URL will be automatically sent to the new URL. This means you don’t have to go and find every single internal link on your site and update them to the new URL. More importantly, you don’t have to find every backlink to your content and try to convince the relevant staff on those websites to update the links to your new URL.

There are a few different kinds of redirects. If you’re only changing the URL temporarily for some reason, you can use a 302 redirect. In most cases, however, you’ll be permanently changing the URL so you should use a 301 redirect.

WordPress doesn’t provide an easy way to set up 301 redirects and having chains of redirects can cause issues for users and search engines, so it’s best to develop a good URL strategy so you don’t have to implement 301 redirects very often. But, when you do find you need to redirect a piece of content, the premium version of Yoast SEO offers a redirects manager

Better still, Rank Math will automatically redirect changed URLs even with the free version of the plugin.

Does a 301 redirect negatively affect SEO and ranking?

A 301 redirect passes 90-99% of existing SERP ranking power to the redirected page. It will, however, take a little time for search engines to discover the 301, recognise it and credit the new page with the rankings and trust of its predecessor. Your webmaster can speed up this process by submitting a new sitemap once the new URLs have been implemented. And if you’re updating your URLs from the WordPress default to SEO-friendly ones, the new URLs should more than make up for any small loss in ranking power with their own increased ranking power.

Additional reading

Your other SEO particulars are also important when you’re trying to improve your content’s ranking in the SERPs. You can use the Yoast SEO plugin to specify these SEO particulars too. If you need some help, check out these articles: