i have following rules meet objective:
- the query string brandpage=1 (example a,b,c,d), needs removed addition query strings retained (example b)
- /browse needs changed /brand
rewritecond %{query_string} ^(.*)brandpage=1&?(.*)$
rewriterule (.*) $1?%1%2
rewriterule /browse/(.*) /brand/$1 [qsa,r=301,l]
examples
a. /browse/aerolatte/_/n-1z13u3z?brandpage=1 b. /browse/room/aerolatte/_/n-4wk7z1z13u3z?brandpage=1&icmp=abc c. /browse/women/womens-tops-600001558/armani-jeans/_/n-53f3z4gpgz1z13u2h?brandpage=1 d. /browse/%c3%a5ry-trays/_/n-1z13va1?brandpage=1
e. should not matched /browse/aerolatte/_/n-1z13u3zq
what redirected url like:
/brand/aerolatte/_/n-1z13u3z
/brand/room/aerolatte/_/n-4wk7z1z13u3z?icmp=abc
/brand/women/womens-tops-600001558/armani-jeans/_/n-53f3z4gpgz1z13u2h
this works examples d, matched e. understand because first rewriterule after rewritecond linked, therefore how can combine 2 rewriterule or can simple chain them altogether using [c] on each line?
i'm using ihs 6.1.0.47 (apache 2.0.47)
i've never done if understand right, try setting environment variable when first rewrite done, adding condition check variable before second rewrite. like:
rewritecond %{query_string} ^(.*)brandpage=1&?(.*)$ rewriterule (.*) $1?%1%2 [e=done:1] rewritecond %{env:done} =1 rewriterule /browse/(.*) /brand/$1 [qsa,r=301,l]
Comments
Post a Comment