Apache 从index.php重写?。。。。要索引.php%3F…html
我正在尝试使用以下wget行创建一个静态的b2evolution站点:Apache 从index.php重写?。。。。要索引.php%3F…html,apache,mod-rewrite,wget,Apache,Mod Rewrite,Wget,我正在尝试使用以下wget行创建一个静态的b2evolution站点: wget -nv -b -m -k -p -E -erobots=off --tries=5 --exclude-directories=calendar,users,user --domains directory http://site.com 它生成如下文件: index.php?blog=2&cat=21.html 正在尝试访问以下网址: http://site.com/index.php?b
wget -nv -b -m -k -p -E -erobots=off --tries=5 --exclude-directories=calendar,users,user --domains directory http://site.com
它生成如下文件:
index.php?blog=2&cat=21.html
正在尝试访问以下网址:
http://site.com/index.php?blog=2&cat=21.html
我在浏览器上收到此错误:
Not Found
The requested URL /index.php was not found on this server.
在error.log上显示以下内容:
[Mon Feb 10 19:02:49 2013] [error] [client xx.xx.xx.xx] script '/var/www/site.com/htdocs/index.php' not found or unable to stat, referer: http://site.com/index.php
但我可以使用%3F代替“?”:
http://site.com/index.php%3Fblog=2&cat=21.html
我的范围是允许使用apache rewrite_mod使用“%3F”修改“?”,使用旧类型的url(带“?”)访问站点。我尝试过:
RewriteRule ^index.php\? index.php\%3F [QSA,NE]
但我在日志中收到此错误:
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
有没有办法用mod_rewrite或其他wget参数解决问题?如果文件名包含
?
,则以下规则应该有效
RewriteEngine On
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^(index\.php)$ $1\%3F%1 [L]
其工作原理如下:
首先计算,匹配项存储在$0、$1、RewriteRule
- 成功后,
将被计算并将匹配项存储在%0、%1、RewriteCond
- 最后,将这两个匹配合并
- 文本
字符被转义为%
(由于\%
用于重写第二次回写引用,因此必须转义)%n
是%3F
的URL编码形式,否则表示查询字符串的开头?
用于匹配非空查询字符串+
?
,则以下规则应适用
RewriteEngine On
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^(index\.php)$ $1\%3F%1 [L]
其工作原理如下:
首先计算,匹配项存储在$0、$1、RewriteRule
- 成功后,
将被计算并将匹配项存储在%0、%1、RewriteCond
- 最后,将这两个匹配合并
- 文本
字符被转义为%
(由于\%
用于重写第二次回写引用,因此必须转义)%n
是%3F
的URL编码形式,否则表示查询字符串的开头?
用于匹配非空查询字符串+
它起作用了。让我解释一下。。通过Cond,您可以得到任何具有0个或更多字符的查询,稍后我们可以将其与%i一起使用(在本例中,i=1)。而不是在()和$1参数之间。里面的点必须被保护,因为它意味着任何字符。最后,我们告诉mod_重写如何转换接收到的url。它是有效的。让我解释一下。。通过Cond,您可以得到任何具有0个或更多字符的查询,稍后我们可以将其与%i一起使用(在本例中,i=1)。而不是在()和$1参数之间。里面的点必须被保护,因为它意味着任何字符。最后,我们告诉mod_重写如何转换接收到的url。