RedirectMatch不工作在htaccess的 [英] RedirectMatch not working in htaccess
本文介绍了RedirectMatch不工作在htaccess的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
荫试图从
从 http://domain.com/article.php?id=23232 到 http://domain.com/article/23232
我使用这个语法在.htaccess
am using this syntax in .htaccess
RedirectMatch 301 article.php?id=(.*)$ http://domain/article/$1
所以请什么是这个错误?
so please what is the error in this?
推荐答案
你不能使用匹配查询字符串 RedirectMatch
。使用的mod_rewrite
规则,而不是:
You cant match query string using RedirectMatch
. Use mod_rewrite
rules instead:
RewriteCond %{QUERY_STRING} ^id=([^&]*)
RewriteRule ^article\.php$ http://domain.com/article/%1? [L,R=301,NC]
这篇关于RedirectMatch不工作在htaccess的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文