I use IIS 7.5 and URL Rewrite.
I have a website with the following file hierarchy:
webroot
webroot/LegacySite
Both webroot/ and legacy/ are separate App-Folders in IIS.
I need to rewrite my URLs so:
- If a request is http://mysite.co/LegacySite/page.aspx the URL will be rewritten to http://mysite.co/page.aspx
Below my Web.Conf
(in the webroot folder) does not work properly, could you point out what I'm missing?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MyRole" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mysite.com" />
<add input="{PATH_INFO}" pattern="^\LegacySite\" negate="true" />
</conditions>
<action type="Rewrite" url="\LegacySite\{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>