Testing Rewrite Rule Patterns

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

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

Oct 10 2008 by zaverio

I have updated the article to show how to find the "Edit Rule" UI.

Oct 10 2008 by ruslany

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?

Jan 21 2009 by SystemLord

TO ALL: PLEASE POST YOUR QUESTIONS ABOUT THE MODULE HERE: http://forums.iis.net/1152.aspx. YOU WILL GET MUCH FASTER RESPONSE!

Jun 06 2009 by ruslany

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

Jun 25 2009 by SystemLord2

Submit a Comment

You must Log In to comment.