.htaccess和?_escaped_fragment_ =

时间:2014-02-25 20:54:01

标签: php apache .htaccess mod-rewrite

我的.htaccess文件现在看起来像(还有别的):

DirectoryIndex index.php

RewriteEngine on

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule ^$ test.php$1 [QSA,L]

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php

当我尝试请求此网址时: http://example.com/test?_escaped_fragment_=blog=123&ggg=3

我从测试控制器看到html,而不是我的test.php文件。请帮忙,我做错了什么?

1 个答案:

答案 0 :(得分:2)

将您的第一条规则更改为:

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule !^test\.php$ test.php [L]