« Previous Next »

Answered Thread: make url_rewrite more dynamic?

Last post 11-18-2009 6:55 AM by par4gon. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 11-03-2009, 11:05 AM

    • par4gon
    • Not Ranked
    • Joined on 11-03-2009, 10:50 AM
    • Posts 3

    make url_rewrite more dynamic?

    i have a classic asp build website, all rewrites work except 1 i cannot figure out what todo.

    the complete url is:

    www.mydomain.eu/cat.asp?AC=435&BC=447&CC=431&bit=11&sortby=19&page=1.

    with a rewrite map i can change AC=435 to office.
    manually i can add a second one BC=447 is paper.

    <add key="/office" value="/cat.asp?AC=435" />
    <add key="/office/paper" value="/cat.asp?AC=435&amp;BC=447" />

    but the problem is BC and CC and Bit and sortby and page aren't always filled
    so i have to create 36 add keys in a rewrite map to cover only the line above.

    is it possible to do it in one rule? or atleast easier?

      

     

     

  • 11-03-2009, 1:00 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 670

    Answered Re: make url_rewrite more dynamic?

    Take a look at this article http://learn.iis.net/page.aspx/665/url-rewrite-module-20-configuration-reference/, see section "Tracking Capture Groups Across Conditions". This should give an idea how to access individual parts of the query string regardless of their order (note that this can be done only in URL rewrite 2.0). After that you can create rewrite map that maps id's to the url segments.

    But overall, the ruleset for this will be pretty complex. I do not think this can be handled by a simple rewrite rule.

    http://ruslany.net
  • 11-04-2009, 6:54 AM In reply to

    • par4gon
    • Not Ranked
    • Joined on 11-03-2009, 10:50 AM
    • Posts 3

    Re: make url_rewrite more dynamic?

    according to the host the 2.0 beta is installed, but as soon as i use the 2.0 script for trackallcaptures i get an internal server error.

    dunno whats wrong with it.

    <rule name="cat" patternSyntax="ECMAScript" stopProcessing="true">
         <match url="^cat\.asp" />
         <conditions trackAllCaptures="true">
              <add input="{QUERY_STRING}" pattern="AC=([0-9]+)" />
         </conditions>
    <action type="Rewrite" url="cat.asp?/{C:1}" appendQueryString="true" redirectType="Temporary" />
    </rule>

    Config Error Unrecognized attribute 'trackAllCaptures'

    So i think my host is wrong about 2.0

     

     

  • 11-09-2009, 4:20 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 670

    Re: make url_rewrite more dynamic?

    Yes, if the module gives this error, then it is not v2.0. You can also confirm it by checking the value of the server variable IIS_UrlRewriteModule. For example if you use PHP then you can get its value by using <?php echo $_SERVER[IIS_UrlRewriteModule]; ?>

    http://ruslany.net
  • 11-18-2009, 6:55 AM In reply to

    • par4gon
    • Not Ranked
    • Joined on 11-03-2009, 10:50 AM
    • Posts 3

    Re: make url_rewrite more dynamic?

    Host doesn't want to install a beta or RC version, any ideas when final release date will be?

    thx for the answers btw. 

     

Page 1 of 1 (5 items)
Microsoft Communities