I’m just messing with netlify and I noticed an annoying issue that can break a website in certain cases. I have some websites that use “.htm” extension and would like to keep it for the sake of legacy, this issue also occurs for “.html” pages
So for example.com/somepage.htm is the original page, but someone by mistake or a wrong link visits example.com/somepage.htm/ ( Extremely common from backlinks and url sharing )
If a trailing slash is added by mistake to either htm/html extension, the site still loads fine, however if a user clicks a link on that page the new page url is now appended. So if the user now clicks anotherpage.htm, the url will go to …com/somepage.htm/anotherpage.htm, which doesn’t exist, if they hit back on their browser they go back to …com/somepage.htm/ and it’s an infinite loop of broken links. Which cannot be fixed unless the user manually knows about the trailing slash in the url and modifies it themselves.
Since _redirects doesn’t allow you to remove trailing slashes, how can one fix this issue? Now of course you can use Pretty URLs feature but that changes the url structure from /somepage.htm to /somepage, and for some use cases this is not the solution wanted
Is it anyway possible to make a html/htm page redirect to a non trailing slash version?
I noticed for Pretty URLS this is done automatically, how can it be done for htm/html extensions.
Thanks for any advice.