I am using the following code to attempt to redirect a dynamic URL to a new dynamic URL, under the same domain:
RewriteRule ^products/item/^\d([^/]+) /product/$1/ [R=301,L]
I've tried these too:
RewriteRule ^products/item/[^\d]([^/]+) /product/$1/ [R=301,L]
RewriteRule ^products/item/[0-9]([^/]+) /product/$1/ [R=301,L]
But this was redirecting /products/item/342/
to /product/42/
, I tested this on a larger number (e.g. 123456789) and it redirected to /product/23456789/
.
It would appear that my rule is not picking up the firsts digit, can anyone help me resolve this?
I've also tried using [\d]
instaled of [0-9]
, but this has the same problem.
Cheers!