Hello,
Can someone help me with this regular expression problem that i am having? I use .htaccess to rewrite my URL's
eg
RewriteEngine On
RewriteRule -Jewellery-([a-z,A-Z,0-9,_]*)\.html /index.php?m=productDetail&p=$1
This finds any product which ends with "-jewellery-100.html", the number 100 can be any number and is my product ID. This works fine, only problem is i have renamed a page and need to do a 301 to the new page, so i now have.
#REDIRECTS -------
redirectpermanent /test/OLD-PAGE-Jewellery-100.html http://www.example.com/MY-NEW-PRODUCT-Jewellery-100.html
#-----------------
RewriteEngine On
RewriteRule -Jewellery-([a-z,A-Z,0-9,_]*)\.html /index.php?m=productDetail&p=$1
This then redirects, but because of the rewrite rule below it passes through a querystring, like so.
http://www.example.com/MY-NEW-PRODUCT-Jewellery-100.html?m=productDetail&p=100
I need to not have the querystring added by the rewrite, so i though something like
RewriteRule ([^OLD\-PAGE]+)-Jewellery-([a-z,A-Z,0-9,_]*)\.html /index.php?m=productDetail&p=$1
But i cannot get it to work as i would like - Someways it redirects but then doesnt recognise the rewrite rule so pages arent found. I have tried a variety of ways and different expressions - but they arent my strong point.
Please can someone help - i am pulling my hair out....
Thanks
Ally