I have migrated a WordPress Mu blog under Linux to WP 3 under IIS 7 so I need to redirect http://mydomain.com/blog/blahblah/ to http://mydomain.com/blahblah/
I added to wordpress web.config
<rule name="rewrite /blog/">
<match url="^/blog/([_0-9a-z-]+)/" />
<conditions>
</conditions>
<action type="Rewrite" url="/{R:1}/" />
</rule>
so that web.config now contains:
<?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>
<rule name="rewrite /blog/">
<match url="^/blog/([_0-9a-z-]+)/" />
<conditions>
</conditions>
<action type="Rewrite" url="/{R:1}/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
WordPress continues to work but /blog/ is not redirected. Why ?
1) Better move this rule above Wildcard rule
2) You had leading slash
^/blog/...— you do not need it:^blog/...3) Because no conditions were used I have also removed
<conditions></conditions>The above is Rewrite rule — you see the same url in browser but behind it executes differently.
If you want Redirect then use the below: