我的网站上有一个地址,如下所示:
http://www.example.com/lookup?q=http%3A%2F%2Fgigaom.com%2F2010%2F10%2F10%2f Angry-birds-for-windows 7-phone-dont-count-on-it% 2F http://www.example.com/lookup?q=http%3A%2F%2Fgigaom.com%2F2010%2F10%2F10%2Fangry-birds-for-windows7-phone-dont-count-on-it%2F
在此示例中,查询字符串“gigaom.com”部分中的点与 lighttpd 和我的重写规则有关。点进去后会得到 404,如果去掉点则不会得到 404。我的重写规则如下。为了以防万一,我使用的是 symfony 1.4。
如果有人能够阐明这个问题,我们将不胜感激!
url.rewrite-once = (
"^/(.*\..+)$" => "$0",
"^/(.*)\.(.*)" => "/index.php",
"^/([^.]+)$" => "/index.php/$1",
"^/$" => "/index.php"
)
对于任何在 lighttpd 和 symfony 方面遇到麻烦的人(我知道你在那里,因为这个问题有很多未解决的线程),我最终在下面解决并回答了它。
好的,经过多次调试后,在以下内容的帮助下:
debug.log-request-handling = "enable"
^^ 当您尝试在lighttpd 中调试重写规则时,这是一个救星! (它为我记录了所有内容到 /var/log/lighttpd/error.log )
我已经弄清楚了。对于所有那些在 symfony 与 lighttpd 一起使用时遇到困难的人(包括点问题!),这里有一组工作规则:
url.rewrite-once = (
"^/(js|images|uploads|css|sf)/(.*)" => "$0", # we want to load these assets as is, without index.php
"^/[a-zA-Z_-]+\.(html|txt|ico)$" => "$0", # for any static .html files you might be calling in your web root, we don't want to put the index.php controller in front of them
"^/sf[A-z]+Plugin.*" => "$0", # don't want to mess with plugin routes
"^/([a-z_]+)\.php(.*)\.(.*)$" => "/$1.php$2.$3", # same concept as rules below, except for other applications/environments (backend.php, backend_dev.php, etc)
"^/([a-z_]+)\.php([^.]*)$" => "/$1.php$2", # see comment right above this one
"^/(.*)\.(.*)$" => "/index.php/$1.$2", # handle query strings and the dot problem!
"^/([^.]+)$" => "/index.php/$1", # general requests
"^/$" => "/index.php" # the home page
)
如果有人遇到更多麻烦,请在这里发帖。谢谢!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)