What is a slug in SEO and how do I optimize it?

What is a slug in SEO?

A slug, in terms of SEO, is the part of a URL (a web page address) that gives a webpage it’s unique name. It tends to be a word or words that are easy to read and explains what that page is about.

So, for example, this page you are on right now has the URL: https://wpcake.com/slug-seo, with the slug being ‘slug seo’. Or, if you like to follow sports on the BBC website, you would go to https://www.bbc.co.uk/sport which has the slug ‘sport’.

Easy to ready slugs allow the website visitor to understand what the page is about. It’s right there in the browser address bar or a search result link. Think about potential visitors to your website who are searching on Google. Which of the following two links are visitors most likely to click on?



The first one tells me exactly what the page topic is. The second one doesn’t tell me anything!

A slug is far more than just a pretty URL though. It’s also important for SEO. An easy to read slug is an important ranking factor for Google. Just like us, Google looks at the URL and should know right away what the content is covering.

What is a slug in WordPress?

WordPress allows you to change how your URL appears in it’s Permalink Settings. In WordPress admin, go to Settings > Permalinks and you will see a variety of options.

The best option to make nice, easy to read URLs is the ‘Post name’ option. This will give you your website domain / page name.

Then, when you create a page or post, you can edit the slug.

SEO slug in Yoast

The Yoast plugin for WordPress is extremely popular. In fact, the free version alone has over 5 million active installs!

Yoast helps you optimize your posts and pages for SEO. It allows you to fill in various fields below your content such as meta description, focus keyword and SEO title. One of these fields is “Slug”. So this powerful plugin is telling us that our slug should be optimized with our focus keyword.


How do I optimize a slug for SEO?

Best slug length for SEO

It is suggested by many SEO experts that the shorter your URL is, the better it is for your ranking. The optimal is between 50 and 60 characters. If you go too far beyond this it could have a negative impact on your rankings.

A good way to keep the character count down is to remove stop words such as “a”, “is”, “of” and “on” if you can. If you are using the Yoast plugin mentioned above it will let you know when you are using too many characters. Words should also be separated with a “-” rather than a blank space.

Use keywords

As mentioned in the Yoast section, you should use your keywords in your slugs. Your page URL is an indicator Google takes into consideration. The slug lets them know what your page is about and what keyword you want people to search for to reach your page.

301 Redirects for any URL changes

Some of you are probably thinking right now – wait a minute, the horse has already bolted! I already have hundreds of indexed URL’s that look really bad.

Fear not as this issue can be fixed using 301 redirects. 301 redirects tell the browser that your old url has moved to a new one. It then redirects the visitor to the new url.

301 Redirects using a plugin

The simplest way to do 301 redirects if you are using WordPress is by using a WordPress plugin. Redirection plugin, which can be downloaded free at WordPress.org, is a good choice with over 1 million active installations. It is as easy as entering the old URL and then the new URL you want the page to go to.

301 Redirects using the .htaccess file

If you have the access, you can also set up redirects manually on your server. You need to locate your .htaccess file in your root directory and open it to edit in notepad (remember to back it up first).

To redirect a single page, at the bottom of the .htaccess file just add a small piece of code similar to below:

Redirect 301 /old-bad-url https://yourdomain.com/new-url

If you want to redirect an entire website then you add the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]


So, as you can see, optimizing your URL’s has multiple benefits. Not only does it improve your visitors experience, it also improves your search rankings. As a result, this can give you a big advantage over similar articles created by your competitors.

There are plenty of tools out there to help you add pretty URL’s for your web pages. If your website has been built with WordPress then it is extremely easy to do in your Permalink Settings. But ultimately, as with anything SEO related, remember to keep your visitors in mind. How easy is it for them to read your URL’s? How easy is it for Google to read them? Will they know right away what your page is about?

To sum up, keep your URL’s short, simple and relevant. If you follow these rules for your slugs, you will keep your visitors and search engines happy.