1
votes

Is it possible to remove a directory from a URL without using a redirect action? In other words can I do it with only a "rewrite" action.

I need to take a URL like this: http://www.example.com/de/folderabc/specs/default.aspx and remove the "folderabc" directory to make it like this: http://www.example.com/de/specs/default.aspx

So far any variation I have tried like this is not working:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="removefolder" stopProcessing="true">
                <match url="folderabc/(.*)" />
                <action type="Rewrite" url="/{R:0}" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

I am using IIS 7.5.

1

1 Answers

0
votes

Try putting a caret ^ in your url to match on.

<match url="^folderabc/(.*)" />