The word “permalink.” Any idea what it means? What about a slug?
You may stumble upon these terms while scrolling around your WordPress dashboard or while reading an article on how to improve your search engine optimization, but what do both of them really mean?
Read this guide to permalinks and slugs to understand the intricacies that go into these sometimes tedious and confusing components of your WordPress sites. We’ll talk about the best permalink structures, how to modify slugs, and more.
What Are Permalinks in WordPress?
A permalink is the URL for your website. Every single page and post on your WordPress site is assigned one of these URLs to make it unique and searchable for other people online.
Search engines use permalinks to find your website pages online, while people can simply take the permalinks and share them or punch them into the browser to visit one of your pages.
If you take a look below the title of your post or page you will see an example of a permalink.
The permalink is the entire URL, so in this example it would include the website (http://www.wpkube.com) and the area behind it (called a slug) which we are also talking about today.
By default, WordPress creates permalinks for you, but you can always go in there and change the default structure. However, whenever you change the permalink structure you have to use 301 page redirects to ensure that the search engines and people who click-through incoming links don’t end up at an error page.
What Are Slugs in WordPress?
The slug, as we briefly talked about above is part of the permalink for your pages and posts. Simply put, a slug is the text that shows up after your primary domain name. For example, the slug for this post is “guide-to-permalinks-and-slugs.”
The concept of a slug is fairly simple, but the effectiveness of the slug depends on what you change it to. WordPress automatically creates a slug for all your posts and pages, but you can click on the Edit button to modify what it says.
Why are Slugs and Permalinks Important?
If hosting is the heart of your website, slugs and permalinks are the skeletal structure. They construct the outline for your site, showing people and search engines where to go.
In a sense, slugs and permalinks work as a digital address for all your content. If someone wants to visit your blog post about how you made $1,000 in one day, they need that address to find where the content is located.
If the slug or permalink structure is changed, search engines and visitors end up landing on a 404 error page.
They also come in handy for SEO and sharing purposes. Slugs provide a unique opportunity to create a short, keyword-based phrase for improved exposure. Relevant and clean permalinks make it easier for search engines to find you, and people are more likely to share if the URLs look less intimidating.
Why You Should Never Just Opt for the Default Permalinks and Slugs
WordPress states that, by default, it uses permalinks with lots of numbers and and question marks. I’m not sure why they do this, but it’s messy and useless for you as a website admin. The default permalink structure is no good for sharing or for search engines to find your site based on relevant information.
The default slugs are a little better, but the system basically pulls all the words from your page or post title and decides to remove some of the shorter words like “the” and “an.”
Two problems arise by using the default slug: The slug is typically too long and messy, and you may lose some of the words that help with your target keywords.
What’s the Best Slug and Permalink Layout?
Now that you know a little bit about slugs and permalinks, you may wonder what the best layouts are for each one.
They both work together, so most of the best practices apply to both slugs and permalinks. Here are a few solid tips for you:
- Keep both slugs and permalinks simple and short.
- Never modify them after you publish a post or page (If this is absolutely required, we will talk about the best method below).
- If you are targeting keywords in your article, place the same keywords in your slug. Target the right keywords and think about just using the keyword alone in the slug.
- Ensure everything is relevant. A date in your permalink structure tells people nothing (It’s only helpful on a magazine or news site where the date is somewhat important.) Include words that apply directly to the page or article.
- Avoid making duplicates of the same slugs. This may happen if you plan on publishing similar posts or pages.
How Do You Change Your Permalink Structure in WordPress?
To start, go to Settings > Permalinks on the left hand side of your dashboard.
Navigate under the Common Settings area and choose the permalink structure you desire. I would recommend going with either the Post Name or Custom Structure permalink layouts. Post Name simply pulls the default post name, so if you write a title for a blog post it will just use that. You can then change the slug on the post page.
If you take a look at the other permalink options you’ll notice that they are not friendly at all. They typically give you dates, numbers and messy combinations. Skip these and go with the Post Name or try to make a cleaner version with the Custom Structure.
How Do You Change Your Slugs in WordPress?
We talked about this a bit above, but it’s always nice to reiterate. The most common slugs appear when you open a Page or Post. You can only modify the slugs when you are in one of these editors. So, let’s say you want to write a blog post and you punch in a title for that post.
To change the slug you simply have to click on the Edit button next to the slug. This opens it up for editing, where you can type in whatever you want.
Categories and Tags Have Slugs Too: How to Change Those
Posts and pages are not the only areas of your website that have slugs. In fact, your categories and tags need slugs as well. So, if someone clicks on a category underneath one of your posts they can get redirected to a page that includes every single post in that category.
How do you change a category slug? Go to Posts > Categories in your WordPress dashboard. If you want to add a new category you can type in the name then create a slug for the field right underneath that. Make sure you click the Add New Category button to save it.
Let’s say you want to change the slug of an existing category. Find the previously created category on the right side of the Categories page and click on the Quick Edit link. This displays an area to modify your slug for that category.
What if you want to add or change a slug for a tag? Go to Posts > Tags on the left hand side of your WordPress dashboard. This process is virtually identical to changing the slug for a category. Create a new tag and include a slug to go with it, or modify one of the existing tags to change around the slugs.
What to Do if Your Slugs and Permalinks are Sloppy Right Now
What if you’ve been running your site for quite some time now and you didn’t previously have the proper permalinks and slugs? Are your URLs filled with long and sloppy dates, numbers and irrelevant text?
This is a huge no-no, so it’s time for you to change the slugs and permalinks. Make sure you follow the proper steps or search engines and visitors will land on error pages, further hurting your exposure online.
You have two options for changing your current permalinks and slugs: Modifying your .htaccess file or using a plugin. Since most of the plugins are fairly lightweight and work well, there’s really no reason to start messing around with code.
Therefore, install and activate the Redirection plugin to get the process started. This basically helps you redirect your old URLs to newer, cleaner ones. Why can’t you just delete the old ones? If you delete them it forces you to lose any SEO momentum you built up before, and you don’t want people landing on error pages after you delete them.
Once the plugin is activated you can go to the Settings page. There’s a nice tool that lets you paste in the old source URL and redirect it to the new, cleaner one.
The plugin also shows you all the error pages on your site so you can go through and decide which ones should get redirected. You have to walk through every redirect manually, but once it’s done you don’t have to worry about it anymore.
Once the old permalinks are redirected to the new ones people won’t end up on error pages and you preserve any SEO you built up from before.
What do your permalinks and slugs look like on your sites? Let us know in the comments section if you have any questions about this guide to permalinks and slugs.