Get wrong PATH_INFO after rewriting in lighttpd

Posted by Satoru.Logic on Stack Overflow See other posts from Stack Overflow or by Satoru.Logic
Published on 2010-12-26T02:43:39Z Indexed on 2010/12/26 2:54 UTC
Read the original article Hit count: 249

In my lighttpd config file, I have a rewrite rule like this:

$HTTP["host"] == "sub.example.com" {
  url.rewrite = (
     "^/(.*)" => "/sub/$1"
  )
}

So when a user visits http://sub.example.com, she's actually visiting http://example.com/sub.

The problem is that the PATH_INFO seems wrong,

   URL: http://sub.example.com/extra
   PATH_INFO:
     expected: /extra
     what I get: /sub/extra

Now whenever I call request.get_path(), it returns something like http://sub.example.com/sub/extra, which is not what I want.

Of course, I can just override the get_path method of the request class, but I wonder if there is a simpler way like changing the lighttpd config?

© Stack Overflow or respective owner

Related posts about python

Related posts about web-development