Remove directory from URL IIS 7.5
- by xalx
I've tried to find a solution to this and found some guides out there but none seem to work.
I have the following URL - http://www.mysite.com/aboutus.html
However there are some other sites which link to my old hosted site and point to http://www.mysite.com/nw/aboutus.html. My issue here is trying to remove the 'nw' directory from the URL's.
I have setup the following URL Rewrite in IIS but it does not seem to do anything,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect all to root folder" enabled="true" stopProcessing="true">
<match url="^nw$|^/nw/(.*)$" />
<conditions>
</conditions>
<action type="Redirect" url="nw/{R:1}" />
</rule>
<rule name="RewriteToFile">
<match url="^(?!nw/)(.*)" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Any insight would be appreciated.