From a4e7daa356426ee7830c0994ed5ac8f3d75cca11 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 22 Jun 2009 23:07:01 +0200 Subject: [PATCH] rename tag www to lighttpd, finish article Signed-off-by: Nico Schottelius --- blog/lighttpd-plone-rewrite-redirect.mdwn | 63 +++++++++++++++++++++++ tags/lighttpd.mdwn | 4 ++ tags/www.mdwn | 4 -- 3 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 blog/lighttpd-plone-rewrite-redirect.mdwn create mode 100644 tags/lighttpd.mdwn delete mode 100644 tags/www.mdwn diff --git a/blog/lighttpd-plone-rewrite-redirect.mdwn b/blog/lighttpd-plone-rewrite-redirect.mdwn new file mode 100644 index 00000000..366f1301 --- /dev/null +++ b/blog/lighttpd-plone-rewrite-redirect.mdwn @@ -0,0 +1,63 @@ +[[!meta title="Mixing redirects and rewrites with lighttpd and Plone"]] + +## The situation + +As you may already know, +[[I am|blog/restart-to-write-news]] +[[migrating|blog/migration-1-configs]] +[[many of|migration-2-freebsd-raid-monitoring-foss]] +[[my websites|migration-3-ccollect]] into this one. + +Today I also began to redirect stuff from my +previous personal website, http://nico.schottelius.org. +I am (still) running [Plone](http://www.plone.org) on that +site, behind [lighttpd](http://www.lighttpd.net/). The +configuration of lighttpd looks like this: + + $HTTP["host"] =~ "^(nico|nico2)\.schottelius\.org$" { + url.rewrite-once = ( "^/(.*)" => "/VirtualHostBase/http/nico.schottelius.org/cms/VirtualHostRoot/$1" ) + + var.logdir = "/home/server/www/nico/nico.schottelius.org/logs/" + accesslog.filename = logdir + "access.log" + + proxy.server = ( "" => ( + ( "host" => "192.168.6.2", "port" => 8082 ), + ( "host" => "192.168.6.2", "port" => 8083 ) + )) + } + +([[a more detailled version can be found here|configs/lighttpd-zope-http-and-https]]) + + +Now I created a new [[about page here|about]] and want to redirect +the old URLs **"^/ueber/nico-schottelius$"** and **"^/about/nico-schottelius$"** +from the Plone site to it. + +First I tried the normal redirect like this: + + url.redirect = ( "^/ueber/nico-schottelius$" => "http://www.nico.schottelius.org/about/", + "^/about/nico-schottelius$" => "http://www.nico.schottelius.org/about/" ) + +Unfortunately, this did not work. You may already have spotted the bug... +The correct way to redirect pages from lighttpd in front of +[Zope](http://www.zope.org), which does ***rewriting*** is to match on the +**rewritten** path! Thus, the following code does the +[correct redirect](http://nico.schottelius.org/about/nico-schottelius): + + url.redirect = ( + "^/VirtualHostBase/http/nico.schottelius.org/cms/VirtualHostRoot/ueber/nico-schottelius$" + => "http://www.nico.schottelius.org/about/", + "^/VirtualHostBase/http/nico.schottelius.org/cms/VirtualHostRoot/about/nico-schottelius$" + => "http://www.nico.schottelius.org/about/" + ) + +You can use [curl](http://curl.haxx.se) to verify the redirect: + + [22:54] ikn% curl -i http://nico.schottelius.org/about/nico-schottelius + HTTP/1.1 301 Moved Permanently + Location: http://www.nico.schottelius.org/about/ + Content-Length: 0 + Date: Mon, 22 Jun 2009 21:01:39 GMT + Server: lighttpd/1.4.19 + +[[!tag lighttpd plone]] diff --git a/tags/lighttpd.mdwn b/tags/lighttpd.mdwn new file mode 100644 index 00000000..be9e8adf --- /dev/null +++ b/tags/lighttpd.mdwn @@ -0,0 +1,4 @@ +[Lighttpd](http://www.lighttpd.net) +related stuff. + +[[!inline pages="tagged(lighttpd)" archive="yes" show=0]] diff --git a/tags/www.mdwn b/tags/www.mdwn deleted file mode 100644 index ad44f77d..00000000 --- a/tags/www.mdwn +++ /dev/null @@ -1,4 +0,0 @@ -[web](http://en.wikipedia.org/wiki/Www) -related stuff. Webservers, websites, etc. - -[[!inline pages="tagged(www)" archive="yes" show=0]]