Google on trailing slashes cover image large

What are trailing slashes, and how do they impact your SEO efforts?

To slash or not to slash – the age-old question. Google treats every URL individually until you tell them not to do so. Historically, a trailing slash marked a directory and a URL without a trailing slash at the end used to mean that the URL was a file. Today, however, trailing slashes are purely conventional, and Google does not care whether you use them; as long as you’re consistent.

What Is a Trailing Slash?

First things first, for those who have no idea what a trailing slash is, here’s an example of two URLs to explain:

  • https://www.example.com/safari
  • https://www.example.com/safari/

The only difference between the two URLs is the slash at the end of the second URL. Both are entirely legitimate URLs, and neither is the correct or incorrect formatting. In the past, the structure of websites was much more rigid than it is today. Back then, every aspect of an URL needed to be accurate, lest a user found themselves in a place they shouldn’t.

The history of trailing slashes and SEO

Trailing slashes were a method of indicating that the current web destination was a folder rather than a file. It specified that it was on a directory page, not a specific page. Directory pages are menu pages that list the various folders and files in that directory – if it contained a folder, it ended with a trailing slash. If it contained a file, there was no trailing slash.

Today, however, modern web systems no longer rely on such a basic file structure. Content is stored in pages, file structures are stored in templates, and files dynamically generate as the page loads. Webmasters also do not need to explicitly use the .html to indicate a blog post or file – the search engines can identify which is which, with or without the additions.

This has left many people confused, as the use of trailing slash can still be pretty varied today. Theoretically, you can keep using the slash if you like, or you can stop using them altogether. The addition or removal of a slash at the end of the URL technically does not make a difference on how search engines view a page or how the browser renders the content.

How Does a Trailing Slash Impact SEO?

When it comes to search engine optimisation, a trailing slash can have a substantial impact on the way content, and pages rank in search engines. If there are two separate pages with the same content – one with a slash at the end of the URL and one without – the two separate pages will be identical, resulting in duplicate content. Google has a hard time figuring out which of the two is the original source, and the search engine crawlers are left confused.

According to Google, individual content should be accessible only through a single URL. If there are multiple pages with different URLs, it will be challenging for several domain variants to establish a secure position in the search engine rankings. While the quality of content may be high, if Google experiences difficulty determining the right source, this will decrease the likelihood of any of the pages ranking well.

duplicate content and trailing slashes

So, while websites can decide whether or not to include a trailing slash, they need to consider how to avoid duplicate content. Incorrectly using trailing slash can lead to search engines becoming confused and impacting the rankings of both pages negatively.

The correct practice for trailing slashes would be to ensure that each page does not have an identical page to contend with. If you do decide to add a trailing slash, be sure that the URL without a slash is 301 directed to the right page, rather than creating a new page or a 404. The same should be applied if the shoe is on the other foot. If your website URL structure does not include a trailing slash, be sure that the URL with the addition of a trailing slash has a redirect to the original page, instead of its existing as a new page.

What Google Says About Trailing Slashes

Google’s John Mueller spoke about trailing slashes in URLs in a twitter not that long ago. The discussion was regarding webmasters finding the use of trailing slashes on URLs confusing. In short, John states that it isn’t necessarily how Google handles the slash at the end of the URL, instead it is how the servers treat them by default.

“The slash after a hostname or domain name is irrelevant; you can use it or not when referring to the URL, it ends up being the same thing… However, a slash anywhere else is a significant part of the URL and will change the URL if it’s there or not.”

URL variations and trailing slashes

John then further explained with a relevant example:

  • https://www.google.com.humans.txt will work fine
  • https://www.google.com/humans.txt/ will result in a 404

As mentioned earlier, “this is not SEO-specific, but just how websites work.”

Wrapping Up

So, there you have it. Using trailing slashes (or not) in your domain URL structure is not the reason for confusion here. Google does not care whether or not you use a trailing slash in your URLs. The thing that does matter is how you use them – Google counts each one as a different URL.

https://www.example.com/safari and https://www.example.com/safari/ are two individual pages. What is most important is that webmasters set up the appropriate measures to avoid duplicate content and pages contending with each other. Managing trailing slashes accordingly means setting up the correct 301 directs or 404 pages rather than having both pages compete for the same rankings.

Not sure where to start? It might be worth consulting with a Sydney SEO Agency that can provide coaching or services for your business.