swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit b55f97387db008b492af14b40f23c43d474d8da7
parent 61e72f7d4e454cf2962742445bbc5c05148594a3
Author: uriel@engel.se.cat-v.org <unknown>
Date:   Tue, 14 Oct 2008 01:46:52 +0200

If we get a request for a .html file, redirect to the 'canonical' url for that file
Diffstat:
Mbin/controller.rc | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 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) {