1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

rewrite conditions

Discussion in 'Apache' started by stephan2307, Nov 11, 2015.

  1. #1
    I am working on a website that lists products. There is also a filter.
    Now comes the problem. We had to change the filter feature and it is now creating slightly different urls and we need to create some 301 redirects based on the query string parameters

    The tricky thing is that the parameters can be in any order and also not all may be present at any time.
    So for example we might have the following query strings


    All we need to do is change the filter to attro and add an additional paramenter

    I googled loads and couldn't find anything so hoping that someone here can help?

    stephan2307, Nov 11, 2015 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Here is one of my attempts
    using this query string ?filter_brand=7882&filter_gender=7888

    RewriteCond %{QUERY_STRING} filter_gender=([0-9]*) [NC]
    RewriteCond %{QUERY_STRING} filter_brand=([0-9]*)
    RewriteRule (.*) /store/?cnpf=1&attro_brand=%2&attro_gender=%1 [R=301,L]
    Code (markup):
    It redirects to
    assigning the brand id to gender and missing the gender id completely.

    Where am I going wrong
    stephan2307, Nov 11, 2015 IP