I'm working on a new project, using Apache's mod_rewrite and PHP to get pretty URLs.
Here's what my URLs look like:
http://example.tld/foo/bar/1/etc
Notice that there's no trailing slash (that's the way I write it in the href attributes of <a>s).
However, I'm also allowing http://example.tld/foo/bar/1/etc/ (trailing slash).
Is this bad practice? I'm wondering if it would be better to only allow one way or if I'd better use trailing slashes in all my links, by default.
Thanks.
Trailing slashes can be a problem when using relative links in the document, as the browser will then treat /etc as a directory.
I would define one way, and set up an external redirect for the other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With