frodo
frodo

Reputation: 1063

RedirectMatch not working

I have this URL:

http://www.example.com/prospective/deginfo.php?classname=PE&diploma_description=BSc+in+Mathematical+Sciences

That I need to redirect to this URL instead:

http://www.example.ie/prospective/deginfo.php?classname=PEC&diploma_description=BSc+in+Mathematical+Sciences+with+French+%27Bachelor+Honours+Degree%27

I thought I could do the following with a RedirectMatch to "catch" everything up to Bsc and from there get it to redirect to the URL I want but it is not working :

RedirectMatch ^/.*BSc\+in\+Physical\+Education http://www.example.ie/prospective/deginfo.php?classname=PEC&degree_description=BSc+in+Mathematical+Sciences+with+French+%27Bachelor+Honours+Degree%27

Can anyone advise what I'm doing wrong and how to correct please?

Upvotes: 0

Views: 356

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

You can't match against the query string in a RedirectMatch, it only matches against the URI. You can match against it using mod_rewrite and a RewriteCond:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^classname=PE&diploma_description=BSc\+in\+Mathematical\+Sciences$
RewriteRule ^/?prospective/deginfo.php$ /prospective/deginfo.php?classname=PEC&degree_description=BSc+in+Mathematical+Sciences+with+French+'Bachelor+Honours+Degree' [L,R]

Upvotes: 2

Related Questions