I am trying to redirect to a page based on a regex expression.
Basically, product codes are made up of numbers and letters, nothing else.
Here is my htaccess:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.*)-(\d{1,2})-(\d{1,3})-(\d{1,3})$ search.php?q=$1&p=$2&m=$3&c=$4
RewriteRule ^([A-Za-z0-9])$ product.php?p=$1 [NC,L]
It is the last line I can’t seem to get to work. It just gives me a 404 page not found error. I know for a fact that the product.php file is there, and it is in the same place as search.php which works fine.
I figured it out.
RewriteRule ^([A-Za-z0-9]*)$ product.php?p=$1 [NC,L]
I guess the * matches infinite times on whats before it.
I found out because if I just went to /e, /E or /8 it would work.