First of all, what am I talking about? Imagine two URLs. Or, don’t imagine them, because I’m going to post them right now.
There’s only one difference between those URLs, and it’s the trailing slash. The trailing slash is the / at the end of the URL.
The question is, do you want to keep that slash in place, or do you want to remove it? Do you want your URLs to look like the first or the second option? Which one is better, for usability or for your readers?
Historically, the web was a much more structured and rigid place than it is today. In the past, it used to be extremely important to get every aspect of your URL exactly right, lest the user end up in a place they shouldn’t. Common “hacker” tools included adding slashes, question marks, and other characters to trigger unwanted behavior in sites, granting access to file directories or back-end folders you wouldn’t normally see.
With the proliferation of CMS platforms like WordPress, more flexible browsers, and automatic redirects away from system folders, it’s a lot harder to reach the back end of a site like that.
Back in the day, a website wouldn’t have to worry about a trailing slash, because web pages were almost always files. You would have pages like www.example.com/blog-post.html. You don’t want a trailing slash after a file type; it just doesn’t make sense.
Trailing slashes were used for one specific thing; indicating that your current destination is a folder rather than a file. It’s a directory page, not a specific page. Directory pages list the various folders and files in that directory, so something like example.com/blog/ might list a 2018 folder, a 2017 folder, and so on. Inside the 2018 folder might be a file called blog-post-1.html, which would be the document for the blog post in question.
Of course, modern web systems don’t use such a basic file structure anymore. They have content stored in pages, they have file structure stored in templates, and they dynamically generate the page when a user loads it.
So, historically you wouldn’t use a trailing slash unless the URL pointed at a directory. Without a trailing slash, you would be pointing at a specific page, generally with a filetype extension like .html or .aspx after it.
These days, you don’t explicitly need the .html to indicate that the page is a blog post, or what have you. You can keep it if you want, or you can ditch it, and it doesn’t make a difference to how the browser renders the page or how the search engines view it. For example, https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html uses a .html filetype, and works just fine. Meanwhile https://moz.com/community/q/trailing-slash-at-end-of-url does not use a filetype extension, and also works just fine. At the same time, https://www.branded3.com/blog/urls-trailing-slash-seo/ does not use a filetype and is not a directory, but does use the trailing slash, and is ALSO just fine.
To sort out which method is best, let’s look at Google.
Google is, of course, smart. It’s one of their defining features as a search engine. They don’t actually care whether or not you use a trailing slash in your URLs. They recognize that, historically, one was a directory and one was not. However, they also recognize that times change, practices change, and that in practical terms it doesn’t really matter.
The official Google statement is the example URL I used just a paragraph ago. It’s from 2010, but even at almost a decade old, the advice still stands.
Google has a few things to say. First of all, the trailing slash does matter. Just like there’s a difference between HTTP and HTTPS, there’s a difference between a trailing slash and no trailing slash. Google counts each one of those as a different URL.
This means that, technically, you could use them as different URLs. You could have different landing pages on www.example.com/landing-page and www.example.com/landing-page/. In general, you absolutely should not do that, though. Why? It becomes confusing for users. If I want to go to the page with the slash, but I type in the URL without the slash, I’ll get different content. If I get different content, the last thing I’ll think about is that little slash. I’ll figure you changed the page, more likely.
To most people using the internet today, things like slashes, trailing or otherwise, are basically invisible. Heck, things like the .com are often invisible. It’s why you find people trying to visit example.net.com; they just default assume everything ends in .com.
Google doesn’t care about the format of your URL, not really. They might give you a very minor penalty if you’re using poor URL formatting, or an equally minor penalty for using very similar URLs, but they don’t actually care. What Google cares about is the uniqueness of the page.
What this means is that you can use any URL format, with or without a trailing slash, and Google will rank you the same either way. The only issue is if you use both formats at the same time. Google might give you a slight penalty if you have different content on the same URL with and without the slash, because it’s a usability issue. If you have the same content on both URLs with and without the slash, you need to use canonicalization, or else Google might give you a duplicate content penalty.
It’s worth noting that the aforementioned Google post from 2010 mentions that duplicate content is okay to have. It was also published in 2010, a year before Panda, Google’s massive anti-duplicate-content penalty algorithm. Rest assured, duplicate content is no longer as okay as they say it was in 2010.
Now, I haven’t actually answered the question. Should you use a trailing slash, or not? Well, the answer is “it depends.” I know, you’re tired of hearing this from me, but it’s true. It always depends on a number of factors.
First of all, do you use filetype extensions or not? If you use a .html for your blog posts, you definitely do not want a trailing slash after it. The same goes for anything else, like .aspx or .php or .whatever. If you have a filetype, do not have a trailing slash, period.
Second, consider what your site defaults to. WordPress, for example, tends to use a trailing slash by default. You can force it one way or another, using built-in parameters, if you choose.
Third, consider if you care about catering to an older, technical audience that might care about a slash. Let’s put it pretty bluntly here; most of your audience, particularly your younger audience, isn’t going to care whether or not you have a trailing slash for your pages. The only people who care are the people who come from an older, more technical generation, and who might be irritated to see a trailing slash when there’s not a directory. For 99% of cases, it doesn’t matter at all.
So here are my general best practices.
First of all, be consistent with what you choose. If you want a trailing slash, implement a trailing slash on every page on your site except those pages with filetype endings. It doesn’t make a huge difference to Google or to your users, but it looks cleaner and it means people won’t necessarily have troubles with adding or removing one.
Secondly, decide if you want to use old best practices and cater to an older audience. You certainly CAN use a trailing slash for directories, while never using a trailing slash for non-directories. That’s perfectly acceptable and informs certain types of users about the structure of your website.
One way you can implement this is similar to Google’s webmaster blog. Take the page I linked to above, this one: https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html. If you visit that link, it’s a blog post. You can tell it’s a blog post because of the .html ending.
Now if you remove the specific filename, you end up with https://webmasters.googleblog.com/2010/04/. This URL is a directory, and it will show you every blog post published in April of 2010 on the Google webmaster blog. If you then remove the 04, to get https://webmasters.googleblog.com/2010/, you will see every blog post published in 2010. You can change 2010 to 2011 and get the following year. This is how a directory structure should work on your site, if you’re using one as logically laid out as that.
However, if you try to do the same thing to my site, you’re just going to break WordPress. So be aware that most sites won’t work like that, and Google is more of an exception than a rule.
Personally, I don’t think it matters if you have your directory pages function. WordPress has things like category pages for that purpose, and a topic-sort is usually more helpful than a date sort anyway. Still, it’s up to you.
The third decision to make is whether or not you want to maintain both options or only one. This is honestly probably the biggest one.
See, a lot of people discussing this topic say you should go one way or another and stick with it for one reason: changing it takes up server resources and time. Specifically, if you want a trailing slash and I visit your page URL without one, you will have to pass me through a redirect, otherwise I’ll end up on a broken page. That redirect means it takes longer to reach your page. Those few milliseconds might not impact my personal attitude, but it’s still a very slight slowdown, and every little bit counts when we’re talking about page load speeds.
Honestly, it really doesn’t matter that much. I can virtually guarantee you that there are at least a dozen other things you could do to your site to speed it up more than eliminating one redirect. However, if you care to that level, you can certainly make the change.
My recommendation, actually, is to simply use both with duplicate content and proper canonicalization.
Yes, duplicate content is bad. If you have www.example.com/blog-post/ and www.example.com/blog-post both at the same time, Google will see two identical blog posts at two different URLs on your site. This is bad, and if it’s done throughout your entire site, it’s doubly bad. That much duplicate content is a penalty for sure.
However, if you always tell Google that the URL with the trailing slash should be canonicalized to the one without the trailing slash, they now understand that the one without the slash is the intended version, and the one with the slash exists just to give access to the page to anyone landing on it without a redirect.
It’s faster, and you have a sort of “soft” redirect if a user continues to browse throughout your page. Every internal link should point to the real version of the page, so anyone landing on a version that has a slash and shouldn’t will then end up on subsequent pages without the slash.
Canonicalization allows Google to ignore the duplicate content as a usability feature rather than a problem. It also means they’ll always index the proper version, so people coming in from Google will never come in on the version that isn’t proper. It solves all of your problems at once.
As for whether or not you want to have the slash or have no slash as your canonical page, well, that’s really just personal preference. If it involves changing a large portion of your site, stick with the one that doesn’t. Otherwise, it doesn’t really matter with the modern internet, modern search engines, and modern users.