I currently have a site hosted on windows and the host provided me with a web.config to enable seo friendly permalinks (for post name). I now need to add 301 redirects but any combination is failing to work, eithe resulting in a “Page not found” when I type the old url in, or a server error. My current web.config (working with permalinks) is this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" 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>
If I add this, anywhere in the file, I get the error
<location path="gallery.htm">
<system.webServer>
<httpRedirect enabled="true" destination="http://mydomain.co.uk/gallery" httpResponseStatus="Permanent" />
</system.webServer>
</location>
I’ve tried putting it inside , removing and placing it in there and also any other possible combinations – is it possible to do this with both features working properly?
Cheers,
Garry.
Try using this as your web.config:
Let me know if that works, if it doesn’t, I’ll go back to the drawing board.