In this lesson, we will talk about permalinks and also explore permalinks settings.
Here are the learning outcomes.
Number one, defining permalinks and slugs.
Number two, changing permalinks using the built-in WordPress settings.
Number three, modifying category and tag links and lastly, redirecting links using a plugin.
So let's get started.
What are permalinks?
Permalinks stand for permanent links.
They are the permanent URLs that point to a specific page or post.
And the latter part of your URL that comes after the domain name is called the slug.
They are user-friendly names to help search engines and users to understand the content
of the page.
Slugs tend to be very similar to their original title of the post or page, or exactly the
same.
And take note, if a title is more than one word, spaces are replaced by a hyphen, as
the example here.
Let's see this in action and open one of the pages on the front end of my website.
When we take a closer look at the permalink, we will see the permalink ends with the name
of the page, namely the slug.
Now we are going to focus our attention on posts.
So let's open up our first post, The World is your Oyster, and as you will see, the
permalink has a date as well as the name of the post.
Let's take a closer look at the permalink settings for our site.
When we are in our dashboard, we will make our way to settings and then click on Permalinks.
Below Common Settings, we will see that the default settings for WordPress is "Day and
Name".
But what does that mean?
It means that the slug of a page will include the name of the page, but the slug of a blog
post will include the date as well as the name of the post.
Let's change the setting to "Only Display the Post Name".
You can also select one of the other options available or create your own custom structure
using their available tags.
Once you have saved your changes, let's go back to our website to see how the permalink
structure for a blog post has changed.
When we take a closer look at the permalink we will see that the date is no longer there.
Next, you also have the option to change the permalink of an individual post or page.
I've created a new blog post and called it "Be on guard and vigilant as there are
pickpockets anywhere and everywhere."
And once we open our blog post, we have quite a long permalink.
Let's modify that to make it more user friendly.
Let's return to our dashboard, open the post and in the sidebar settings click on the URL.
The URL slug is the entire name of the post.
So let's replace that by typing in Pickpockets only.
And once we click on Update, we can view the post on the front end and now the slug only
displays 'pickpockets.'
Lastly, let's discuss permalinks for categories and tags.
Let's open the World is your Oyster post.
Scroll down and here you will see a category called Travel and a tag called Adventure.
Let's click on Travel.
This page will of course display all posts that have been assigned to the travel category.
And the permalink will include the word 'category' and then the name of the category in this
case 'travel.'
But if we go to permalink settings, we can actually change the word 'category' or 'tag.'
At the bottom below optional, it says if you like, you may enter custom structures for
your category and tag URLs here.
So instead of saying 'categories', we can change it to something like 'topics.'
And instead of your tag permalink saying 'tags', it can say 'key words' for example.
To see this applied on the front end, let's open up the World is your Oyster post.
Scroll down and then click on the travel category.
The permalink now says 'topics' and 'travel' and not 'categories' and 'travel' anymore.
Finally, we have to talk about redirecting permalinks.
Make sure you only change link structures when a blog post or page is new.
If you change an old permalink on an established website, visitors will not automatically be
redirected to the new link.
So if you don't want to affect your search engine ranking or traffic to your established
site, you need to make sure you install a plugin to redirect your old URLs.
Let's make our way to plugins, add new and in the search box, type in 'Redirect links.'
There are different options to choose from, but I'm going to install an open source plugin
called Redirection.
When you are ready, click on Install and then activate the plugin.
Once the plugin is installed, click on Settings.
Then go ahead and click on Start Setup.
And once you have gone through all the steps, you can click on Ready to Begin.
When you are on the options page, click on Redirects top left.
And here you can redirect old URLs.
The source URL refers to your old permalink or URL.
And the target URL is your new URL that you will be using.
Let's use our pickpocket post as an example.
So next to source URL, enter the old permalink.
And next to target URL, let's paste our new permalink.
And when you are ready, add redirect.
So now when somebody clicks on your old link on an established site, they will be redirected
to the new URL.
I trust you now have a better grasp on managing your Permalinks.