Testing Rewrite Rule Patterns

Author: Ruslan Yakushev

Published on September 11, 2008 by iisteam

Updated on May 27, 2009 by iisteam

Average Rating  Rate It (0)

RSS

URL Rewrite Module UI includes a tool that can be used to test the regular expression and wildcard patterns used within rewrite rules and conditions. With this tool you can very quickly verify the correctness of the pattern; you can check how the pattern is applied to various input strings and what values are stored in back-references. Also, this tool can be used as a first step in troubleshooting of rewrite rules, by checking if the problematic URL matches the rule patterns correctly. This article explains how to use the "Test Pattern" tool.

Launching the "Test pattern" dialog

The "Test pattern" tool can be used to test rule pattern and condition patterns. To test rule patterns open URL Rewrite Module UI and select a rule in the rules list and click on "Edit...":

Then click on the "Test pattern..." button in the "Edit Rule" page:

To test condition pattern, select a condition in the conditions list view and then click "Edit...". In the "Edit Condition" dialog click on "Test pattern..." button:

Using "Test pattern" tool

In the "Test Pattern" dialog, enter a string that you want to match against the pattern. Click on "Test" button:

The results of the pattern match and the list of rule back-references will be displayed. Similarly, if you use "Test pattern" tool for testing of patterns used in conditions, the results will show the list of condition back-references:

Note that you can make changes to the pattern, while within "Test Pattern" dialog. If you've made any changes to the pattern, when you click on "Close" button you can choose whether to preserve or ignore the changes to the pattern.

Summary

The "Test pattern" tool provide a simple way for testing regular expression and wildcard patterns used in rewrite rules and conditions. The tool can be used to test and adjust patterns as well as to troubleshoot rewrite rules with incorrect patterns.

Related Content

Comments

  1. Submitted on Oct 10 2008 by
    zaverio
    Hello,

    I was no able to find the "Edit Rule" in order to use the "Test pattern" tool.
    I am ate http://learn.iis.net/page.aspx/500/testing-rewrite-rule-patterns/

    Please help.


    thanks
  2. Submitted on Oct 10 2008 by
    ruslany
    I have updated the article to show how to find the "Edit Rule" UI.
  3. Submitted on Jan 21 2009 by
    SystemLord
    Where can i download this program? Anyone have a great site that explains rewrite rules? I need it for my http://audi4life.com site. URL's should be redirected to from something like this www.domain.com/bmw/LINK.html to www.domain.com/phpfile.php?link=LINK&style=BMW Can anyone else help me with this?
  4. Submitted on Jun 06 2009 by
    ruslany
    TO ALL: PLEASE POST YOUR QUESTIONS ABOUT THE MODULE HERE: http://forums.iis.net/1152.aspx. YOU WILL GET MUCH FASTER RESPONSE!
  5. Submitted on Jun 25 2009 by
    SystemLord2
    Thank you ruslany, was going crazy trying to figure this out; Highly recommend the form link! Helped me set up most redirects and rewrite rules for my site http://www.americancylinderheads.com

You must Log In to comment.