Support » Fixing WordPress » Exclude Directories in Rewrite web.config Windows iis

  • Resolved likemindsdesigns

    (@likemindsdesigns)


    Help! I have a client who is hosting on their own web server, with Windows iis. I have no familiarity with this Windows platform.

    There are two folders in the root that need to be excluded from the WordPress rewrite rule.

    How can I edit my web.config rewrite so that it excludes those two folders? This is my web.config code below. I assume that the * needs to have some statement to exclude ‘clients’ and exclude ‘portal’.

    <configuration>
    	<system.webServer>
    		<rewrite>
    			<rules>
    				<rule name="wordpress" patternSyntax="Wildcard">
    				<match url="*" ignoreCase="false" />
    						<conditions>
    							<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    							<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    						</conditions>
    					<action type="Rewrite" url="index.php" />
    				</rule>
    			</rules>
    		</rewrite>
    	</system.webServer>
    </configuration>
Viewing 1 replies (of 1 total)
  • If this helps anyone else, I was able to cobble something together from viewing other web.config edits

    <configuration>
    	<system.webServer>
    		<rewrite>
    			<rules>
    				<rule name="wordpress" patternSyntax="Wildcard">
    				<match url="*" ignoreCase="false" />
    						<conditions>
    							<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    							<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    							<add input="{REQUEST_URI}" pattern="^/(portal|patient)" negate="true" />
    						</conditions>
    					<action type="Rewrite" url="index.php" />
    				</rule>
    			</rules>
    		</rewrite>
    	</system.webServer>
    </configuration>

    This one line (below) is the only change, where “portal” and “patient” are the names of my exclusion folders. I THINK this is working, but I would appreciate input from anyone who has experience with this type of code.

    <add input="{REQUEST_URI}" pattern="^/(portal|patient)" negate="true" />

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude Directories in Rewrite web.config Windows iis’ is closed to new replies.