4

If I used the native URL-Rewrite module to rewrite (not redirect) a URL, does it return 302, 301, or 200? Is this method OK to use for a permanent URL rewrite?

Here is sample code for the redirect:

   <rewrite>
        <rules>
            <rule name="Rewriter" patternSyntax="ExactMatch" stopProcessing="true">
                <match url="foobar" />
                <action type="Rewrite" url="/actual/foobar.aspx" />
            </rule>
        </rules>
    </rewrite>

1 Answer 1

3

Since the rule is only rewriting the URL, it should return a standard '200' HTTP header code (assuming there are no other errors). If you had used a redirect action type instead of rewrite, then you would have received a 301 or 302 HTTP response code depending on how the rule was configured. There are a variety of tools available that you can install on your local client to view the HTTP response codes that are being returned to the browser. A very popular one is Fiddler which provides a lot of monitoring details. These types of tools can be very useful when debugging rewrite and redirect rules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.