I’m new to rewrite and right now I have a genuine problem with rewrite. Here is what I am trying to do.
2/cat23/subcat104/Shoes (I am trying to change this url to products.php?p=2&m_id=23&s_id=104&pg=Shoes )
The above represents (2=page number),(23=categoryid),(104=Subcategoryid),(Shoes=subcategoryname)
Now on iterating my $_request I get this:
p => 2
m_id => 23
pg => subcat104/Shoes (it didn't separated them since the '/' was also present between them)
Now following is my rewrite rule which seems ok but not delivering the result.
*RewriteRule ^([0-9]+)/cat([0-9]+)/subcat([0-9]+)/(.+)$ products.php?p=$1&m_id=$2&s_id=$3&pg=$4 [NC]*
and I wanted the result to be:
*p => 2
m_id => 23
s_id=>104
pg => Shoes*
I checked your code and it works for me, I added your Rewrite code in my
.htaccessfile:Make sure you have declared the
RewriteEngine Onbefore the rule.The result I got from
$_REQUESTwas:If you are still having trouble, post your
.htaccessfile and avar_dump.