Mar*_*arc 1 mod-rewrite symfony1 lighttpd url-rewriting
我的网站上有一个地址,如下所示:
在这个例子中,查询字符串的'gigaom.com'部分中的点与lighttpd和我的重写规则紧密相关.我得到一个带有点的404,如果我把点拿出来没有404.我的重写规则如下.万一它有所作为,我正在使用symfony 1.4.
如果有人能对这个问题有所了解,我将不胜感激!
url.rewrite-once = (
"^/(.*\..+)$" => "$0",
"^/(.*)\.(.*)" => "/index.php",
"^/([^.]+)$" => "/index.php/$1",
"^/$" => "/index.php"
)
Run Code Online (Sandbox Code Playgroud)
对于任何遇到lighttpd和symfony问题的人(我知道你在那里,因为这个问题有很多未解决的问题)我最终解决并在下面回答它.
好了,经过多次调试后帮助:
debug.log-request-handling = "enable"
Run Code Online (Sandbox Code Playgroud)
^^当你试图在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
)
Run Code Online (Sandbox Code Playgroud)
如果有人有更多麻烦,请在此处发布.谢谢!