4 ms·
This is the correct answer. Relative paths are incorrect without a trailing slash. Use trailing slashes please.
by tmpfs 5y ago
This is the correct answer. Relative paths are incorrect without a trailing slash.
Use trailing slashes please.
- 3np 5y agoEither could be desired behavior and neither is incorrect. If anything, just be consistent within a single site. IMO you're most likely good as long as you consciously pick one, you know why you picked it, and stick with it.
- Enderboi 5y agoI literally just closed a ticket about this issue yesterday.. 'why are these relative URLs downloading from the parent folder'. "Because your CMS is rewriting out trailing slashes. Make it stop that, and then you'll be in the relative path you think your in". The internet uncertainty principle: It's not DNS, it's trailing slashes. (apologies to Herr Heisenberg :)
- hypertele-Xii 5y agoMaybe stop "thinking you're in a path" and actually explicitly define which path you wanna be on [1]. The <base> element has existed expressly for this purpose since 1991, although it was called <address> in the first draft. [1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ba...
- jeroenhd 5y agoIt depends on your expectations. For example, you could construct a page on https://blog.example.com/my-summer-vacation-2020 https://blog.example.com/my-summer-vacation-2020 and load all resources in the form of static/style.css, static/comments.js, media/header.webp and so on. As long are you're aware of the differences and the way your web server resolves static content, you can pick either, whatever you prefer. I have no idea what Vercel, Render, and Azure Static Web Apps even are, but you should obviously be aware of their limitations when using them to host HTML. I'm sure there are plenty of other behaviours that differ between them and there's hardly any universal truth to be found in the decisions some big corporations once made. This article seems more about the default slug-to-content resolution algorithm from a bunch of cloud providers than it is about trailing slashes.