When search engines crawl a page on your site, they look everywhere for clues to what your content is about: the title, headers, body, image alt text, meta description, even the URL.

In fact, URLs are one of the first elements search engines crawl. They also contribute to the first impression of your readers as well. URLs that are too long or contain strings of random numbers and letters instead appear less clickable and less trustworthy than URLs that convey information about the content of the page.

For these reasons, optimizing your URLs is an essential step in improving youron-page SEO.

In this post, we’ll define what a slug is and explore some best practices for optimizing them. Then we’ll take a look at the different ways you change them in WordPress.

Grow Your Business With HubSpot's Tools for WordPress Websites

To ensure we understand what a slug really is, let’s take a brief look at thedifferent parts of a URL. Starting from left to right, we’ll break down this post’s URL, pictured below.

Example URL to break down into parts of the URL

First, there’s the scheme, where you’ll most often see https:// (or http:// is the site isn’t secure). Then there’s the subdomain, like “blog” in this URL or simply “www” in others. Next there’s the second-level domain — the name of the website — and the top-level domain, which is most often .com.

After the first slash is the subdirectory, which indicates what subsection of the website we’re on. In this post, the subdirectory is “website” because we’re on the website section of the HubSpot blog.

After the second slash is the slug. Before we walk through how you can change the slugs on your WordPress site, let’s go over some best practices for optimizing them. That way, you’ll know exactly what you’re doing when you log into your dashboard to change them.

How to Optimize a URL’s Slug in WordPress

Designing for humans and botsshould be a guiding principle for everything you do as a site owner. That includes optimizing a URL’s slug in WordPress. To optimize them for search engine bots as well as your readers, follow the best practices below.

Include 1-2 Keywords

Make sure to include the keyword phrase you want to rank for in your slug. Both search engines and readers will look here to determine what the page or post is about. The general syntax should look like: websitename.com/topic-mentioned-here.

Match the Title (But Don’t Replicate It)

You want a URL’s slug to closely match the title of the post or page. If one is about dachshund puppies and the other is aboutWordPress SEO, for example, bots and readers are going to be confused.

However, optimizing slugs isn’t as simple as copying and pasting the title of the post or page. Since the ideal length of titles is 60 characters or less, titles are much longer than slugs should be. They also use spaces and Title Case, whereas slugs should use hyphens or underscores and lowercase.

Remove Any Unnecessary Words

You can make slugs more readable by omitting pronouns and prepositions like “a,” “the,” and “to.” These are known asstop wordsand are generally ignored by search engines anyways. A general rule of thumb is if readers and search engines can fill in the gaps and make sense of the slug without certain words, omit them.

Now that we’ve covered these tips and techniques, let’s look at them in action. Here’s some examples comparing the title vs. the slug of HubSpot blogs:

Title Slug
The Anatomy of a Search-Friendly URL [Infographic] url-structure-search-friendly
25 +最好的博客工具增加你的博客2020 best-blogging-tools-grow-blog
Serverless Functions: Your Website's New Best Friend serverless-functions
9 Squarespace Alternatives & Why You Might Want Them squarespace-alternatives

Keeping these best practices in mind, let’s now walk through the process for changing a URL’s slug in WordPress.

How to Change a URL's Slug in WordPress

By default, WordPress uses the “plain” permalink structure, as shown below.

Navigate to settings > permalink to change structure and individual URL slugs

Because it contains the account name and some random characters and numbers rather than keywords, this is not an SEO- friendly structure.

Changing this default permalink structure is an important step inmaking your WordPress blog SEO-friendly. You can do so by navigating toSettings>Permalinksand selecting another option. We recommend “Post name” because it is the shortest and includes relevant keywords.

Click Post name and Save Changes to change permalink structure in WordPress so you can edit URL slugs

Please note that it’s important to change your permalink settings during the set-up process. If you change them after your site goes live, then you’ll have to set up redirects to ensure there are no broken links on your site. Fortunately, there are plenty ofredirect WordPress pluginsto help simplify this process if you need them.

Once you see the notification that your permalink structure has been updated successfully, you can now edit the slug of individual posts and pages on your site. Let’s walk through the process step by step.

1.Navigate toPosts>All Poststo edit an existing draft orAdd Newto create a new draft. You can follow these steps forPagesas well.

Navigate to Posts > All Posts to start process for changing URL  slug

2.If you navigated to All Posts, then scroll to the draft you want and click编辑.

Click edit to edit draft in WordPress to continue process for changing URL  slug

3.On the right-hand side of the screen, click the optional control next toPermalinksto open the dropdown menu.

Clicking permalink dropdown menu in WordPress Gutenberg editor to change slug

4.编辑the slug. In this case, I’ll change the original slug from “how-to-change-a-url's-slug-in-wordpress” to “how-to-change-slug-wordpress.”

Changing URL slug in WordPress Gutenberg editor

5.ClickSave Draftin the toolbar at the top of the screen.

Click Save draft to complete process of changing URL slug

You can repeat this process for all your posts and pages moving forward. This will ensure you’re creating SEO-friendly URLs that delight search engine bots and your site visitors.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Jun 17, 2020 7:00:00 AM, updated June 17 2020

Topics:

WordPress Website