Thursday, 19 September 2013

(mod) Rewriting Out of Order Parameters

(mod) Rewriting Out of Order Parameters

Is it possible to re-write parameters that are not always in the same
order in a URL?
For example, we might have a url like

/products/type/animal/id/123456
But it could also appear as:

/products/id/ab123456/type/animal
Using a mod rewrite statement like
/products[.html?]?(?:/id/([^/])?)/?(?:/type/([^/])?)/?
"products.html?id=$1&type=$2" [L, NC]
works fine for the the first example but of course fails for the second.
Is there anyway around this?

No comments:

Post a Comment