昨天注意到, Web.py程序, 在Lighttpd下进行重定向时候:
总在url最后会出现真实的主程序名称, 比如:
- raise web.seeother('/')
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:
- fastcgi.server = ( "/code.py" =>
- ((
- "socket" => "/tmp/fastcgi.socket",
- "bin-path" => "/path/to/root/code.py",
- "max-procs" => 1,
- "bin-environment" => (
- "REAL_SCRIPT_NAME" => ""
- ),
- "check-local" => "disable"
- ))
- )
关键点在于, 加上这两个参数.
url rewrite的时候照样.