Jass Jass - 26 days ago 10
PHP Question

url rewrite when only parameter is on left and we need multiple on right

I have website in PHP and I am doing url rewrite using htaccess.

My current URL is


iYIDziy4kG = unique key

I want to make it like


I have made rule like this

RewriteRule products/(.*)/(.*)/(.*)/(.*) product.php?view=$1 [L]

and when I use


then it is picking unique key "iYIDziy4kG" in first (.*) but as per my requirements, it should be in last (.*)

what could be the possible solution in this case?

Answer Source

Either remove the parenthesis around the first three parameters or change $1 to $4.