From 8877df8fe1261d1c597a254e103392d4ccce572b Mon Sep 17 00:00:00 2001 From: Uriel Date: Tue, 14 Oct 2008 01:46:52 +0200 Subject: [PATCH] If we get a request for a .html file, redirect to the 'canonical' url for that file --- bin/controller.rc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/controller.rc b/bin/controller.rc index 0e051dd..dd3e572 100755 --- a/bin/controller.rc +++ b/bin/controller.rc @@ -179,10 +179,9 @@ fn select_handler { if not if (test -f $body.html) set_handler html_handler $body.html - # Handle explicit .html urls, this should not happen (the web server will usually handle this anyway) - # XXX We probably should setup a permanent redirect to $body|sed 's/.html$//' here + # Explicit .html urls, usually the web server will handle this as static files if not if (~ $body *.html && test -f $body) - set_handler html_handler $body + perm_redirect `{ echo $REQUEST_URI|sed 's/.html$//' } # Rss feeds. TODO: we should check that the request is for a real blog dir if not if (~ $REQUEST_URI */index.rss) {