« Previous Next »

Answered Thread: Migration to IIS 7 Rewrite from ISAPI

Last post 11-06-2009 5:31 PM by ruslany. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 10-31-2009, 4:18 PM

    • DanielFR
    • Not Ranked
    • Joined on 10-31-2009, 8:11 PM
    • Posts 1

    Migration to IIS 7 Rewrite from ISAPI

    Hello.

    I have this rule with ISAPI. This rule use a txt file to convert url to id (see example). This is possible on IIS 7?

    Thanks!

    RewriteMap detalle txt:detalle.txt
    RewriteCond ${detalle:$1|no-exist} ^(?!no-exist)(.*)
    RewriteRule ^([^?/]+)\.html$ guias_detalle.asp?cod=${detalle:$1}

    www.mysite.com/optiona.html > www.mysite.com/select.asp?id=1

    ///

    Example txt file

    optiona 1
    optionb 2
    optionc 3

    ///

     

     

  • 11-05-2009, 10:39 PM In reply to

    Re: Migration to IIS 7 Rewrite from ISAPI

     Hi,

     I don't think you can map such a url by using the default IIS7 rewrite module. two alternative options:

    1. Redirect urls one by one

    2. Write your own rewrite url module.

     Regards

     

    Sincerely
    Microsoft Online Community Support
    Andrew Zhu - MSFT


    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 11-06-2009, 5:31 PM In reply to

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

    Answered Re: Migration to IIS 7 Rewrite from ISAPI

    If the requirement for storing the url to id mappings in an external text file is not critical, then you can use Rewrite Maps to accomplish this functionality (the xml is not formatted correctly):

    <rewriteMap name="detalle" defaultValue="no-exist">
      <add key="optiona" value="1" />
      <add key="optionb" value="2">
    ...
    </rewriteMap>

    <rule name="rule">
      <match url="^([^?/]+)\.html$" />
      <conditions>
        <add input="{detalle:{R:1}}" pattern="^no-exist" negate="true" />
      </conditions>
      <action type="rewrite" url="guias_detalle.asp?cod={detalle:{R:1}}" />
    </rule>

    http://ruslany.net
Page 1 of 1 (3 items)
Microsoft Communities