I try to make the URL like the following
http://domain/d1/d2/k1/val1/k2/val2/k3/val3
To be
http://domain/index.php?one=d1&two=d2&k1=val1&k2=val2&k3=val3
Above one and two are fixed keys, the rest of the path is for key-value pairs. When I have more key-value pairs (more than three) attached after /d1/d2/, how do I write out the URL rewrite rules?
Update#1:
Below is what I have so far. I cannot have a dynamic key value pairs appended at the end of the first two folders.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !\.(css|png|jpe?g|gif)$ [NC]
RewriteCond %{REQUEST_URI} !index\.php [NC]
RewriteRule ^([^/]+)/([^/]+) /index.php?one=$1&two=$2 [QSA,L]
I was thinking to add one more folder "query" (see below) to help for pattern match for key-value pairs because you know after query all the folders are about key-value pairs. But, I cannot go further.
http://domain/d1/d2/query/k1/val1/k2/val2/k3/val3