user576510
user576510

Reputation: 5905

url-rewriting omitting directory from url?

Is it possible to remove a directory from URL? for example for the below urls:

http://localhost:50656/umbraco/Surface/HealthInsurance/Application?Pid=26665&Lid=73&Spid=23

http://localhost:50656/umbraco/Surface/HealthInsurance/Results/73

there need to remove umbraco/Surface/ and make it

http://localhost:50656/HealthInsurance/Application?Pid=26665&Lid=73&Spid=23

    http://localhost:50656/HealthInsurance/Results/73

Please guide what will be regular expression for this.

Upvotes: 0

Views: 62

Answers (1)

John Babb
John Babb

Reputation: 951

In the web server section of your web config you can add the following. It will match the url .*, which is everything and will map it to /umbraco/Surface/{R:0}. The R:0 is the entire captured response. Make sure you have the module installed. Here is a tutorial on how to check if you have your rewrite set and you can test it. http://www.iis.net/learn/extensions/url-rewrite-module/testing-rewrite-rule-patterns

<system.webServer>  
    <rewrite>
        <globalRules>
            <rule name="MapUmbarco">
                <match url=".*" />
                <action type="Rewrite" url="/umbraco/Surface/{R:0}" />
            </rule>
        </globalRules>
    </rewrite>

</system.webServer>

Upvotes: 1

Related Questions