I've restructured a WordPress site that's hosted on a Windows server, so I'm trying to redirect with a web.config file. I've tried dozens of variations from examples and I can't make it work. The new urls have changed from this:
www.mysite.com/wp/whatever-else
to this:
www.mysite.com/whatever-else
Some examples I've tried include:
<rewrite>
<rules>
<rule name="WP Redirect">
<match url="^(.*)/wp/(.*)" />
<action type="Rewrite" url="{R:1}/{R:2}" />
</rule>
</rules>
</rewrite>
<rewrite>
<rules>
<rule name="WP Redirect">
<match url="^(.*)/?wp(.*)" />
<action type="Rewrite" url="http://www.mysite.com/{R:1}" />
</rule>
</rules>
</rewrite>
<rewrite>
<rules>
<rule name=""WP Redirect" stopProcessing="true">
<match url="^com/wp/?" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="true">
</conditions>
<action type="Redirect" url="{R:1}/" />
</rule>
</rules>
</rewrite>
Any suggestions? I'm stumped. Thanks.
Try this one:
<rewrite>
<rules>
<rule name="WP Redirect" stopProcessing="true">
<match url="^wp/(.*)$" ignoreCase="false" />
<action type="Redirect" redirectType="Permanent" url="http://www.mysite.com/{R:1}" />
</rule>
</rules>
</rewrite>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With