Mod rewrite Lighttpd配置。(点)在我的查询字符串中导致404

Mod rewrite Lighttpd配置。(点)在我的查询字符串中导致404,mod-rewrite,symfony1,url-rewriting,lighttpd,Mod Rewrite,Symfony1,Url Rewriting,Lighttpd,我在我的网站上有这样一个地址: 在本例中,查询字符串“gigaom.com”部分的点与lighttpd和我的重写规则发生了冲突。我得到一个404,点在里面,如果我去掉点就没有404。我的重写规则如下。如果有区别,我使用的是symfony1.4 如果有人能解释一下这个问题,我们将不胜感激 url.rewrite-once = ( "^/(.*\..+)$" => "$0", "^/(.*)\.(.*)" => "/index.php", "^/([^.]

我在我的网站上有这样一个地址:

在本例中,查询字符串“gigaom.com”部分的点与lighttpd和我的重写规则发生了冲突。我得到一个404,点在里面,如果我去掉点就没有404。我的重写规则如下。如果有区别,我使用的是symfony1.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
  )

如果有人有更多的麻烦,在这里张贴。谢谢

我正在使用PHP、MySQL和.htaccess文件重写规则。只是分享,这样其他人也能受益

我以前的规则:

RewriteRule ^([^/\.]+)/([^/\.]+).html$ detail.php?name=$1&id=$2 [L]
它正在处理这一结果:

我想要的是网站名称,而不是url中的标题。在网上冲浪之后,我发现正如你上面提到的,是这个点造成了这个问题

"^/(.*)\.(.*)$"    => "/index.php/$1.$2", # handle query strings and the dot problem!
因此,我将规则更改为:

RewriteRule ^([^/]+)$ detail.php?url=$1 [L]

在这之后,我得到了我想要的结果:

如果查询“www.gigaom.com”中有两个点,会发生什么?只要尝试一下,就可以了。我还更新了我在过去一个小时内发现的一系列其他案例(例如backend.php等其他应用程序)和插件文件的规则。我唯一需要解决的问题是大写字母,比如backend.php/News作为一个路径。你知道我如何得到这个案例吗?点线不适合我。再说一次,我也有两个点。那又是怎么写的呢?谢谢你,马克,它帮了我的忙!这是错误的:答案是针对Apache的,而不是针对lighthttpd的。如果点很重要,则应使用反斜杠
\。
对其进行转义,而不是盲目删除。