我有这个网址:
http://www.example.com/prospective/deginfo.php?classname=PE&diploma_description=BSc+in+Mathematical+Sciences
我需要重定向到此网址:
http://www.example.ie/prospective/deginfo.php?classname=PEC&diploma_description=BSc+in+Mathematical+Sciences+with+French+%27Bachelor+Honours+Degree%27
我认为我可以使用RedirectMatch
执行以下操作以“捕获”Bsc
之前的所有内容,并从那里将其重定向到我想要的网址但不起作用:
RedirectMatch ^/.*BSc\+in\+Physical\+Education http://www.example.ie/prospective/deginfo.php?classname=PEC°ree_description=BSc+in+Mathematical+Sciences+with+French+%27Bachelor+Honours+Degree%27
有人可以告诉我我做错了什么以及如何纠正吗?
答案 0 :(得分:2)
您无法与RedirectMatch
中的查询字符串匹配,它只与URI匹配。您可以使用mod_rewrite和RewriteCond
:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^classname=PE&diploma_description=BSc\+in\+Mathematical\+Sciences$
RewriteRule ^/?prospective/deginfo.php$ /prospective/deginfo.php?classname=PEC°ree_description=BSc+in+Mathematical+Sciences+with+French+'Bachelor+Honours+Degree' [L,R]