readthedocs.org icon indicating copy to clipboard operation
readthedocs.org copied to clipboard

redirect: Clean file URLs as well

Open LecrisUT opened this issue 1 year ago • 3 comments

What's the problem this feature will solve?

Currently the clean URL redirects /path/to/my_page/ to /path/to/my_page.html, but it doesn't do that for /path/to/my_page.

Describe the solution you'd like

It would be good to have an equivalent that can to that redirect for the file paths as well (those that do not have any suffix).

Alternative solutions

Tried to write a redirect manually for /* to /:splat.html, but that did not work, not to mention that it would fail for properly suffixed files.

Probably this is an issue that can/should be solved upstream, but I am not sure what solution to suggest to them.

npx serve seems to serve the static files just fine. Would there be any method to mimic that?

LecrisUT avatar Mar 14 '24 16:03 LecrisUT

Probably this is an issue that can/should be solved upstream, but I am not sure what solution to suggest to them.

What do to mean by upstream here? Whom are them?

npx serve seems to serve the static files just fine. Would there be any method to mimic that?

I'm not sure to follow this. How is npx serve related to this issue here?

humitos avatar Mar 18 '24 10:03 humitos

Currently the clean URL redirects /path/to/my_page/ to /path/to/my_page.html, but it doesn't do that for /path/to/my_page.

If I understand correctly, the redirect doesn't work when there is no a trailing slash, right?

humitos avatar Mar 18 '24 10:03 humitos

If I understand correctly, the redirect doesn't work when there is no a trailing slash, right?

Yes, that sums it up

What do to mean by upstream here? Whom are them? I'm not sure to follow this. How is npx serve related to this issue here?

mystmd is the upstream site-generator. Basically is it an issue for the site-generator and/or site hosting? It seems that npx serve does this kind of redirection automatically, that's why I mention it here. But it could be an issue on how the pages are produced, since I don't think sphinx has a similar issue if you open the index.html file manually.

Still, this could be solved on the RTD side as a temporary fix?

Upstream issues:

  • https://github.com/executablebooks/mystmd/issues/188
  • https://github.com/executablebooks/mystmd/issues/950
  • https://github.com/executablebooks/mystmd/issues/984

LecrisUT avatar Mar 18 '24 11:03 LecrisUT