php - web.config rewrite condition with exception -
i have 2 file web.config wordpress setting this:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <rule name="wordpress" patternsyntax="wildcard"> <match url="*"/> <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>
i want add exception if in folder wordpress, rule not running.
in case, have 2 wordpress installed setting->permanentlinks->post name, 1 in root directory (http://example.com/) , other in /wordpress (http://example.com/wordpress) directory.
the second wordpress (/wordpress) change web.config rule name="wordpress2" , work, if want view sample-page (http://example.com/wordpress/sample-page) page redirect 404 page not found.
change match url showing below, hope help.
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <rewrite> <rules> <rule name="main rule" stopprocessing="true"> <match url="^(.*)/$" /> <conditions logicalgrouping="matchall"> <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>
Comments
Post a Comment