AJM
AJM

Reputation: 32490

URL Rewrite IIS - Map From One Path To Another

I am playing with URL rewrite in IIS 7

The behaviour I want is when someone types in

[http://localhost/Sales]

they get redirected to [http://localhost/SalesDemo]

but they still see [http://localhost/Sales] in the browser URL

Is this possible?

Upvotes: 1

Views: 902

Answers (1)

Tom
Tom

Reputation: 26829

The best way to achieve that would be to use Rewrite Maps in URL Rewrite Module.

Alternatively you could add rewrite section to your web.config file.

Web.config example:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Rewrite rule">
                    <match url="^Sales$" />
                    <action type="Rewrite" url="SalesDemo" />
                </rule>
            </rules>
        </rewrite>

    </system.webServer>
</configuration>

Please note that the action type needs to be Rewrite (and not Redirect) if you still want to see /Sales in your browser.

I hope that will help.

Upvotes: 1

Related Questions