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 have a URL Rewrite setup for clean URLs in a CMS and my web.config looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Clean URLs" stopProcessing="true">
                    <match url="^([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="?id={R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

It basically turns index.php?id=something into something for clean URLs. Very simple and it works well.

As is common in CMSs, to prevent the back-end from breaking, each subdirectory requires either <remove name="Clean URLs" /> or <clear /> in its web.config so the rule isn't inherited.

Is there a way of specifying in the parent rule that it shouldn't be inherited by its children at all by somehow limiting the rule's scope to only the current directory? Something like <rule name="Clean URLs" stopProcessing="true" inherit="no"> would be epic.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Found the answer after 4.5 hours of Googling!

http://runtingsproper.blogspot.co.uk/2010/04/solved-breaking-parent-webconfig.html

Basically taking advantage of

<location path="." inheritInChildApplications="false"> 
    <system.webServer>
        <!-- ... -->
    </system.webServer>
</location>
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.