Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 6 '12 at 6:39

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 0 down vote accepted

Was able to resolve this issues with the following

            <rule name="RemoveDirectory">
                <match url="nw/(.*)" />
                <action type="Rewrite" url="/{R:1}" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^www.mysite.com$" />
                </conditions>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.