Should my site’s URLs without trailing slashes redirect to trailing slash versions? Or should my trailing slash URLs redirect to non-trailing slash versions? What if some page types do it one way and other page types do it another way? What about canonical URLs? And what’s up with file extensions at the end of URLs?
Magic SEO Ball says: concentrate and ask again.
Lots of issues here, some of which are referring to SEO best practices and others of which are closer to personal preference and which just require a simple decision and some consistency.
First issue: file extensions.
It made sense in the 1990s, when we manually wrote websites in individual html files, for those files to be uploaded using FTP clients into folders, and for the files in the folders to have URLs like page.html (or page.htm). This doesn’t make sense now. If you’ve built a new site in the past decade, its URLs probably shouldn’t be using file extensions like .html or .htm, .aspx or .asp, .php, &c.
Second issue: consistency.
Your site needs to have a coherent URL structure, and that coherence needs to extend all the way down to whether every URL has a trailing slash or whether not a single URL has one. Admittedly, this is in part a QA issue: you should never land on a page on your own site and not know if the URL is correct or whether you’re looking at a page that shouldn’t exist.
Pick one option or the other, trailing slash or non-trailing slash, and go with that option for all pages, without exceptions. Since you’re going with one or the other, implement redirects at the app level from the one you didn’t chose to the one you did choose: http://domain.tld/directory/page/ should redirect to http://domain.tld/directory/page or vice versa.
Third issue: choosing trailing slashes or not.
I recommend that you choose trailing slashes for two reasons:
- Another QA issue: it’s easier to see that you’ve landed on a page with a trailing slash and it’s the correct page, and if you’ve landed on a page without a trailing slash know that it’s the incorrect page, than vice versa.
- WordPress uses trailing slashes. WordPress is the default web publishing tool, so using WordPress-style URLs is a good idea.
Of course, this is largely a personal judgment call.
Fourth issue: canonicals.
You already know that a self-referencing canonical actually needs to reference itself, as opposed to a different URL that doesn’t exist.
In other words, if you’ve chosen to use trailing slashes, but you’ve created the URL incorrectly at http://domain.tld/directory/page instead of http://domain.tld/directory/page/, the canonical needs to be http://domain.tld/directory/page (the page that actually exists), not http://domain.tld/directory/page/ (the page that should exist).
Got that? Canonical URLs actually have to be for the pages as they exist, not as they ought to exist.
Of course, if both http://domain.tld/directory/page and http://domain.tld/directory/page/ resolve, fix the problem by redirecting according to your URL rules and make sure the canonical on the target page is correct.
Bonus: capital letters.
When you’re creating a new site and putting URL rules in place for trailing slash or non-trailing slash, you may as well decide that none of your URLs will use any capital letters, and that any URL with capital letters should be redirected to an all-lowercase version.
Bonus bonus: do the trailing slash redirect and the lowercase letters redirect in the same step so there’s only ever one redirect instead of two jumps.