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.
A trailing slash usually indicates a directory, without a trailing slash it indicates a file.
Allowing both with and without trailing slash will have a negative effect on your search engine ranking, because the same content is indexed twice. Stick to one, and do a 301 redirect if a user requests the other.