Web.py下Lighttpd URL重写的问题

昨天注意到, Web.py程序, 在Lighttpd下进行重定向时候:

  1. raise web.seeother('/')
总在url最后会出现真实的主程序名称, 比如:

http://127.0.0.1/main.py/aaa/

这个问题在官方的网站上有记载:

Since revision 145, it is necessary to set a bin-environment variable on the fastcgi configuration if your code uses redirects. If when your code redirects to http://domain.com/ and in the url bar you see http://domain.com/code.py/, you'll need to set the environment variable. This will cause your fastcgi.server configuration above to look something like this:

  1. fastcgi.server = ( "/code.py" =>
  2. ((
  3.    "socket" => "/tmp/fastcgi.socket",
  4.    "bin-path" => "/path/to/root/code.py",
  5.    "max-procs" => 1,
  6.    "bin-environment" => (
  7.      "REAL_SCRIPT_NAME" => ""
  8.    ),
  9.    "check-local" => "disable"
  10. ))
  11. )

关键点在于, 加上这两个参数.

url rewrite的时候照样.

你可能感兴趣的:(Web.py下Lighttpd URL重写的问题)