Configure URL Rewrites in web.config for IIS

Goal

Map internal application URLs to different public-facing URLs without redirects (no 3xx responses, no browser URL changes).

The Difference

Rewrite ≠ Redirect. A rewrite maps URLs at the IIS level before they reach your application.

IIS URL Rewrite Module Documentation

Basic Example

Expose /internalendpoint as /publicendpoint:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="basic" stopProcessing="true">
                    <match url="^publicendpoint$" />
                    <action type="Rewrite" url="/internalendpoint" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

The match URL uses regex. stopProcessing="true" prevents further rule evaluation after a match.