Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在lighttpd中重写后获取错误路径信息_Python_Lighttpd_Pathinfo - Fatal编程技术网

Python 在lighttpd中重写后获取错误路径信息

Python 在lighttpd中重写后获取错误路径信息,python,lighttpd,pathinfo,Python,Lighttpd,Pathinfo,在我的lighttpdconfig文件中,我有这样一个重写规则: $HTTP["host"] == "sub.example.com" { url.rewrite = ( "^/(.*)" => "/sub/$1" ) } 因此,当用户访问http://sub.example.com,她实际上正在访问http://example.com/sub 问题在于PATH\u INFO似乎是错误的 URL: http://sub.example.com/extra P

在我的
lighttpd
config文件中,我有这样一个重写规则:

$HTTP["host"] == "sub.example.com" {
  url.rewrite = (
     "^/(.*)" => "/sub/$1"
  )
}
因此,当用户访问
http://sub.example.com
,她实际上正在访问
http://example.com/sub

问题在于
PATH\u INFO
似乎是错误的

   URL: http://sub.example.com/extra
   PATH_INFO:
     expected: /extra
     what I get: /sub/extra
现在,每当我调用
request.get_path()
,它都会返回类似
http://sub.example.com/sub/extra
,这不是我想要的


当然,我可以重写
request
类的
get\u path
方法,但是我想知道是否有一种更简单的方法,比如更改lighttpd配置?

如果您想要预重写URI,请尝试
请求URI
。一般来说,如果您有重写规则,那么它就是您实际想要的重写路径,否则重写就没有意义了。

请您向我介绍一些有关请求变量(如路径信息和请求URI)的介绍,好吗?有很多,在PHP中,您可以调用
phpinfo()
查看完整列表,尽管没有描述。谢谢,Steve-o。我还有另一个问题:我能否得出这样的结论:请求\u URI==脚本\u名称+路径\u信息?