trailing slash page canonicalization

Eric Wong normalperson at yhbt.net
Sun May 15 13:17:37 CEST 2016


"Jason A. Donenfeld" <Jason at zx2c4.com> wrote:
> We have another potential issue, however. git.zx2c4.com/cgit and
> git.zx2c4.com/cgit/ have the same content, yet different URLs. This
> might be looked upon unfavorably by search engines. One rectification
> is to add a meta tag. Another, and one I'd like to consider here, is
> to always add the trailing slash to pages with the same 301 trick as
> [1].

I think canonicalizing is a good idea to improve cacheability, too.

For HTML, I favor trailing slash for consideration with people
who want to mirror to a static site (e.g. with "wget -r -np").
That results in "$DOCROOT/foo/index.html" on the FS; making it
easy for common configurations of static HTTP servers to serve
for "/foo/" using the "$DOCROOT/foo/index.html" file.

Without the trailing slash, "wget -r -np" would create a
"$DOCROOT/foo" file, and it's not easy to serve the right
Content-Type with a static file server that way.


More information about the CGit mailing list