shithub: werc

Download patch

ref: 9b2054f1e745f35252a5a405d2e1c340ae840ae9
parent: d52d0b7581c3c870379a25b4d4f0f4a80155a3af
author: uriel <uriel@engel.se.cat-v.org>
date: Mon Oct 13 21:46:52 EDT 2008

If we get a request for a .html file, redirect to the 'canonical' url for that file

--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -179,10 +179,9 @@
     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) {