Reputation: 47
I want to redirect
http://www.mydomain.com/rakhi-blog/index.php/2012/06/20/my-article/ to http://www.mydomain.com/rakhi-blog/2012/06/20/my-article/
For this I use the following code:
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="index.php" />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<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/{R:0}" />
</rule>
<rule name="Rewrite Index">
<match url="^index.php/*" />
<action type="Redirect" url="/rakhi-blog/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
But This Code is not working. Can Any one Help Me Pls.
Upvotes: 1
Views: 19417
Reputation: 1047
try:
<rewrite>
<rules>
<rule name="Rewrite Index">
<match url="^rakhi-blog/index.php/(.+)$" />
<action type="Redirect" url="/rakhi-blog/{R:1}" />
</rule>
</rules>
</rewrite>
Upvotes: 2
Reputation: 40756
In the past, I used the instructions in the article "Using Failed Request Tracing to Trace Rewrite Rules" to find and resolve such issues.
Basically, you turn on tracing and see what and why IIS is actually redirecting (or not redirecting). You then can see whether your expectations match the actual results.
Upvotes: 0