I have a directory that lists products by categories. if a _GET
variable exists, it is used in a query. I would like to use "pretty url's", like: example/a/1/b/2/c/3/d/4
becomes example/index.html?a=1&b=2&c=3&d=4
most .htaccess
examples I see only use variables to replace the _GET
values, but I can use rules like this:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ index.html?$1=$2&$3=$4&$5=$6 [L]
RewriteRule ([^/]+)/([^/]+)/([^/]+)/([^/]+)$ index.html?$1=$2&$3=$4 [L]
RewriteRule ([^/]+)/([^/]+)$ index.html?$1=$2 [L]
And it works... However, the when I add longer and longer RewriteRules
(like out to &17=$18
), it stops working. The last variables in the chain turn into some sort of array based on earlier values (in above it would build index.html?a0=a1&a3=a4
)...
- Is there a better way to do this?
- It seems inefficient?
- Is there a limit to the number of variables in
.htaccess
- How long a rule can be?
Thanks!