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.

Read more here: wordpress on shared windows hosting - enabling seo friendly permalinks and 301 redirects


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , , , , ,

Wordpress related questions and answers: