To Slash or Not to Slash at the End of a URL
I learned this only recently - that there is actually a difference depending on whether a URL ends with a / or not. I had assumed that a URL with a trailing slash and one without it would just be treated as the same page. In the browser, the difference does not look very meaningful, and most people do not spend their lives paying that much attention to URLs anyway. But recently I read this article.
/foo/ and /foo look almost identical to human eyes. But from a search engine's point of view, they can be two separate URLs. They may serve the same content, one may redirect to the other, or in the worst case they may even be treated as entirely different pages.
I unified a lot of different places where URLs appear - sitemap, canonical, hreflang, hyperlinks, and so on. If I was going to keep the slash, I kept it everywhere. If I was going to remove it, I removed it everywhere. I picked one version and standardized everything around it. Since Google's own blog said that was the better way, I followed that.
Google uses trailing slashes consistently, even in its sitemap. GitHub, on the other hand, does not. People say it does not matter that much, but I standardized it anyway. In the end, the first article I read about this was Google's, so I decided to follow Google and keep the trailing slash. After doing that, some odd results that used to show up from time to time in Search Console started lining up cleanly.
All posts