Trailing Slash on Website URLs
Trailing slash on website URLs has a long history of debate whether it is good or bad practice. Should you put trailing slashes on your site’s URLs?
Let me say it upfront. I prefer my URLs to be clean and without a slash at the end of it.
Trailing slashes just add an unnecessary character to the URL.
History of URLs
URLs (uniform resource locator) which are also URIs (uniform resource identifier) are modern versions of the way UNIX systems reference a resource, be it a file or a directory (or folder if you’d like to call them that). It’s a principle that still holds true today on most if not all operating systems. Basically, resources that are referenced by an identifier ending with a slash are directories. Those that do not end with a slash are files.
It’s that simple.
People understand that and the concept. But most webmasters and experts on the industry still misuse forward slashes, justifying it with all sorts reasons like, it doesn’t matter anymore, for example. (see more below).
Search Engine Optimization
What about SEO? According to Google Webmaster’s To slash or not to slash, they treat both versions equally. So there’s really no reason choosing the slashed version over the conventionally correct non-slash version.
Trailing slashes has nothing to do with Search Engine Optimization or ranking higher in search engines.
Some people also claim that non-slash URLs impacts page loading speed because of the redirection. It’s true only if you use trailing slashes and you try to access a page without a trailing slash. It’s the same if you’re not using trailing slash and you access the page with a slash at the end. Which balances, or even nullifies the argument regarding the impact on page loading speed.
Trailing Slash on Website URLs as Pretty Links?
URLs with a trailing slash are viewed by most as pretty. Links without a slash at the end are viewed as wonky. Because filenames should have extensions. But extensions are just that, extensions. They’re not required for filenames. A lot of core files on both Windows and Linux do not have extensions.
I guess Facebook, Twitter, and GitHub links are ugly. 😉
https://web.facebook.com/japalekhin
https://twitter.com/japalekhin
https://jap.alekhin.io/trailing-slash-website-urls
I don’t know, looks good to me!
The Verdict
SEO: It doesn’t matter.
Loading Time: No impact.
Pretty URLs: Subjective. In my opinion. No trailing slash is cleaner.
Reason: By convention, no trailing slash if it’s a file, and it’s usually a file you’re accessing, not a folder.
Sadly, self-hosted WordPress blogs (like this blog) have trailing slashes at the end of URLs by default. The first thing I do when I set up a site is to actually clean the permalinks by removing the trailing slash. I hope more people see the sense of the convention and how an extra character does not make any link pretty. Let me know what you think in the comments below.