多视图和重定向的问题


Problems with Multiviews and redirecting

我最近停用了htaccess文件中的Multiview选项。它完美地完成了这项工作,但我们还使用了一个外部应用程序,该应用程序使用扩展文件(http://example.com/export_me?mode=csv&id=3)调用链接。所以链接不再工作了,我想使用重写规则来纠正这个错误(我没有访问应用程序)

RewriteCond %{REQUEST_URI} ^export_me?mode=(.*)&id=(.*)'$
RewriteRule (.*) export_me.php?mode=$1&id=$2 [L]

但是我仍然有一个404错误。

有人能帮我吗?

Thx

试试这个:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ export_me.php?/$1 [L] 
</IfModule>

为什么不直接:

RewriteRule ^export_me$ /export_me.php [L]

查询字符串将被自动追加。您不能匹配%{REQUEST_URI}变量中的查询字符串,只能匹配' %{QUERY_STRING}变量。