I am trying to use RewriteRule in htaccess to permanently redirect this:
http://www.example.com/store/scripts/prodView.asp?idproduct=240
to
http://www.example.com/index.php?route=product/product&path=59&product_id=50
I have tried:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^idproduct=240$ [NC]
RewriteRule ^store/scripts/prodView.asp$ index.php\?route=product/product\&path\=59\&product_id\=50? [L,NC,R=301]
.htaccess is in the root
Can anyone suggest where I may be going wrong? Thank you
I have solved this problem with the help of Croises although I don't know the full reason for the problem.
In my original question, for brevity, relevance and clarity, I left out some some RewriteRule code that was lying above the code I was writing. This code was provided by the shopping cart software.
The totality of the RewriteRule code was thus:
Croises question below got me thinking “why is my code being ignored?”. I therefore put my code above the shopping cart’ RewriteRule code and now it works, although I don’t understand why the other code was interfering with my code.
The code that now works is:
I guess I have therefore answered my question but with help from Croises. My apologies for leaving out some important information in the original question
Try with:
Without
\?
in RewriteRule url