adaoraul/rack-jekyll

Redirect /path/to/dir to /path/to/dir/

stomar opened this issue · 0 comments

For directories with index page, do not serve /path/to/dir/index.html as /path/to/dir, because this breaks relative URIs in index.html.

Example: when the index page links to page.html, then (starting from /path/to/dir) the URI is resolved as /path/to/page.html and not as /path/to/dir/page.html.

Therefore, the request should result in a 301 to the path with trailing slash, /path/to/dir/.

Logic (for /path/to/resource):

  1. search for /path/to/resource (a file)
  2. then, if not found, search for /path/to/resource/index.html
    • if found, respond with 301 to /path/to/resource/
    • if not found, respond with 404