.htaccess rewrite rule
Posted: Fri Apr 17, 2009 7:10 am
Not strictly php, but uses regexes which I suck at...
I'm using database values to fake a directory structure, eg:
site.com/products/category/productname
which I want (for now, anyway) to end up at:
site.com/products/index.php?cat=category&prod=productname
I've tried this code and get a 404:
RewriteEngine On
RewriteRule ^products/([a-z]+)/([a-z]+)/$ products/index.php?cat=$1&prod=$2 [L]
I've placed the .htaccess file in my root folder so it should be working.
Any ideas?
Matt
I'm using database values to fake a directory structure, eg:
site.com/products/category/productname
which I want (for now, anyway) to end up at:
site.com/products/index.php?cat=category&prod=productname
I've tried this code and get a 404:
RewriteEngine On
RewriteRule ^products/([a-z]+)/([a-z]+)/$ products/index.php?cat=$1&prod=$2 [L]
I've placed the .htaccess file in my root folder so it should be working.
Any ideas?
Matt