paleobiodb / bug_reports

Description of recent enhancements to the Paleobiology Database and project management
7 stars 4 forks source link

API documentation pages produces 404 error if trailing slash not included #35

Open naheim opened 3 years ago

naheim commented 3 years ago

The main API documentation page loads when the following are entered into the web address bar: https://paleobiodb.org/data1.2/index.html, https://paleobiodb.org/data1.2/index, https://paleobiodb.org/data1.2/

However, when the trailing slash is omitted (https://paleobiodb.org/data1.2), a 404 error is returned.

This seems like new behavior and is non-intuitive for many users. Perhaps a redirect was dropped?

I reproduced this error on Mac OS Catalina using the latest versions of Safari and Firefox.

dwbapst commented 3 years ago

Huh, that's odd. Same thing on Linux Mint (Ubuntu 19) with Firefox. You get a 404, but (usually) a web server should return a 301 (page location permanently moved) when it is asked for a page that doesn't exist but is the name of a directory, and silently redirect to the directory URL if and when a trailing slash is missing, where we would then be given the index.html at that location:

https://paleobiodb.org/data1.2/index.html

(The actual page we see when we go to https://paleobiodb.org/data1.2/ )

More on best practices regarding trailing slashes here: https://stackoverflow.com/questions/5948659/when-should-i-use-a-trailing-slash-in-my-url

Is it possible that the pages were duplicated before, so there was a duplicate of the index at https://paleobiodb.org/data1.2.html ? (Obviously, having duplicate pages isn't best practice...)