cmillr / simple-md

A very-simple website platform based on PHP and Markdown.
1 stars 0 forks source link

URL Trailing Characters #2

Open cmillr opened 12 years ago

cmillr commented 12 years ago

One of the settings in the index.php file should be to allow the user to configure trailing characters for their paths.

For example, a user should be able to put content in `/content/foo/bar.md' and configure the URL to behave in any of the following ways:

  1. http://example.com/foo/bar/
  2. http://example.com/foo/bar
  3. http://example.com/foo/bar.html
  4. http://example.com/foo/bar.php

…and/or anything else the user would like to configure.

cmillr commented 12 years ago

Ideally, this should be failure-proof too. It should read any URL and first look for a match based on the current URL rules. If no match is found, it should strip the extension (if it finds one) and look for a document matching that; if one is found, it should send the 301 response and redirect the browser to the canonically-correct URL.

This would mean if someone has configured .html-trailing in their URL settings, a link to example.com/foo/bar would 301 to example.com/foo/bar.html, and so would any other non-canonical variant.