.htaccess RedirectMatch在htaccess中不工作

.htaccess RedirectMatch在htaccess中不工作,.htaccess,.htaccess,我正在尝试重定向我的页面 从 到 我在.htaccess中使用此语法 RedirectMatch 301 article.php?id=(.*)$ http://domain/article/$1 那么,请问这是什么错误?您无法使用重定向匹配来匹配查询字符串。改用mod_rewrite规则: RewriteCond %{QUERY_STRING} ^id=([^&]*) RewriteRule ^article\.php$ http://domain.com/article/%1? [

我正在尝试重定向我的页面

从 到

我在.htaccess中使用此语法

RedirectMatch 301 article.php?id=(.*)$ http://domain/article/$1

那么,请问这是什么错误?

您无法使用
重定向匹配来匹配查询字符串。改用
mod_rewrite
规则:

RewriteCond %{QUERY_STRING} ^id=([^&]*)
RewriteRule ^article\.php$ http://domain.com/article/%1? [L,R=301,NC]

谢谢,先生,但这只是重定向到,不带ID。对不起,有打字错误,请立即更正。请再试一次。