A URL Slug is the part of the URL that follows the slash (“/”) after the domain name or subfolder. URL parameters and hash parameters are not parts of the URL slug.
Good URL slugs are usually in an easy-to-read format which helps the readers and search engines better understand the content on the page. However, slugs can also contain numbers, dates and days, the author’s name, and more based on the structure of the website’s permalink.
Thanks to WordPress where a slug is clearly visible and easily editable the term became widely used among webmasters and SEOs.
https://ahrefs.com/blog/keyword-research/#finding-keyword-ideas
In the example above, keyword-research is the URL slug.
While many factors affect the rankings of your page, the URL slug as a factor is overrated in the SEO community. Many people are obsessed with stuffing keywords in their URL, thinking it would drastically improve their rankings for the target keyword.
Google’s Search Advocate, John Mueller, says that URL is a very lightweight factor for rankings.
Below is an extract from John’s conversation about the importance of URL Slug:
“We use the words in a URL as a very very lightweight factor. And from what I recall this is primarily something that we would take into account when we haven’t had access to the content yet. So if this is the absolute first time we see this URL we don’t know how to classify its content, then we might use the words in the URL as something to help rank us better. But as soon as we’ve crawled and indexed the content there then we have a lot more information. And then that’s something where essentially if the URL is in German or in Japanese or in English it’s pretty much the same thing.”
- John Mueller, Search advocate
Hence, sometimes it does help Google understand the content on the page before indexing it. However, after indexing, it becomes irrelevant as Google gets access to a lot more information to help it rank.
So, does this mean URL slugs don’t matter at all, and it isn’t necessary to have descriptive slugs?
An informative and descriptive URL can help the readers instantly understand the page’s content and make them more likely to click it.
For example, if you share this URL, https://ahrefs.com/blog/what-is-a-url-slug/ with a friend where what-is-a-url-slug is a descriptive slug, it would give your friend a clear idea about the topic of the article.
However, had it been something like https://ahrefs.com/blog/article-123, your friend would not know what the content is about. This might make it unlikely for them to click on the URL as they might find it less exciting or even suspicious.
A descriptive slug also makes it more likely to be remembered and even linked to.
Here’s another statement from John mentioning URLs should be made user-friendly more than SEO-friendly.
https://twitter.com/JohnMu/status/1296006310488662016
Now that you know it is essential to optimize URL slugs to make them user-friendly, let us dive into the four best practices you should follow while customizing your slugs.
Even though the keywords in a URL won’t boost your rankings significantly, it’s one of the best SEO practices to include the main topic or keyword in the URL slug.
It is best to keep them short and simple to make them more rememberable and comprehendible to give a gist of the title.
So rather than having /what-is-keyword-density-and-why-is-it-important as a slug, use /keyword-density.
It is always good to separate words in the slug to make it easily understandable.
Google recommends using hyphens to separate words in your slug instead of using underscores. It identifies hyphens as word separators, thereby helping it understand what the page is about.
This applies primarily to blog posts. Let’s say you write an article in 2022 with the slug /best-domain-providers-2022, but next year, you wish to update it to 2023 with more relevant data. For this, you will have to set a redirect to ensure that the user doesn’t end up on a 404 page.
Thus, it is best to avoid using dates and make the slug something like /best-domain-providers.
Although most web servers treat lower and uppercase URLs the same, this doesn’t hold true in all cases. Technically, everything after the domain name in a URL is case-sensitive, and thus, some servers will treat them differently.
Since URLs have traditionally been in lowercase, it’s recommended to use the same to make it simpler.
The URL is the full path which contains the protocol, domain name, and slug. At the same time, the slug is the piece of URL that comes after the backlash, i.e., /what-is-a-url-slug in this case.
To change the URL slug format, you need to modify the permalink structure in WordPress. Here’s how to do it:
Google Chrome and most modern browsers allow a URL to be up to 2048 characters. But that does not mean that you should use them all. Stick to using 3-5 catchy words in the slug.
Editing a URL slug changes the address of the page. This means that all the links that pointed to that page will no longer work, and the user will see a 404 error.
To prevent this, you will have to create a redirect from the old URL to the new one. In WordPress, this can be done easily with redirection plugins.