I am trying to redirect the following URL: old URL: /resources/abc.php?x=a1234
new URL: /r-abc-x-a1234
I need to do this to redirect old bookmarked URLs to the new SEO friendly ones.
This is the rule I am using:
RewriteCond %{QUERY_STRING} ^([a-z]+)=([a-z_0-9]+)$
RewriteRule ^/resources/(.*).php$ /r-$1-%1-%2 [R=301,L]
I am getting this result-
http://example.com/r-abc-x-a1234?x=a1234
As you can see, I am getting close to the final result however getting that query string appended to the redirected URL.
How can I avoid that? I am new to mod_rewrite and learning a lot through your excellent web site. However, not able to crack this issue.
Any help would be much appreciated.
Thanks a bunch.