Skip to content

Handling redirects in published HTML pages #16

@ScottAbbey

Description

@ScottAbbey

Summary

I propose that we create a file (or files) listing redirects, then use the --website-redirect option of the AWS CLI tool within the promote-release tool to publish these as 301 Moved Permanently redirects to the appropriate locations.

Background

There are now a significant number of links on the web that point to what are essentially "This page has moved" pages on https://doc.rust-lang.org.

Multiple issues have been raised regarding these pages, including rust-lang/rust#42632. Refer to that issue for specifics on some of the ways these redirect pages are creating problems. In short, both search engines and users clicking links are finding themselves on pages that don't need to exist.

Proposal

For pages that amount to no more than a "go here instead" message, we should consider serving 301 Moved Permanently responses when there is a definitive target.

For example, https://doc.rust-lang.org/tutorial.html should just redirect to the link it highlights.

A large collection of pages from the first edition of the book, like https://doc.rust-lang.org/book/enums.html, should just redirect to the new URL for the first edition, like https://doc.rust-lang.org/book/first-edition/enums.html. (Those pages also highlight the existence of a second edition, which can alternatively be highlighted from the actual result pages.)

Anything previously under a /stable/ link that has now moved would be a good candidate as well.

I assume there are other opportunities for redirects that I have not listed here.

Plan

From what I can tell, the publish_docs function here is sending all these pages to https://doc.rust-lang.org. I assume there is a CDN layer in front of that, as well.

Several of the AWS CLI commands (like cp, here) have a --website-redirect option that can be used to attach metadata indicating that requests for an object should be served with a 301 Moved Permanently response.

In order to call this command, we will need to have a list of individual pages that need to be redirected, and the new location for each.

Questions

  • Is using 301 redirects on these pages an appropriate solution?

  • Will a 301 redirect in S3 work properly with the CDN that is presumably in front of it?

  • Should this redirect listing reside in rust-lang/rust-central-station, or should there be one in each of the various projects that end up in rust-docs\share\doc\rust\html? (book, nomicon, reference, std, unstable-book)

  • What is a good format to use for a file listing redirects?

Ref: rust-lang/book#760

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docIssue that affects doc.rust-lang.orgC-new-featureA new feature that we could implement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions