WordPress 301 Redirects on IIS





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







4















I am really struggling with getting the 301 redirects working on our server after deploying a new website. Everything I have tried has either resulted in a 500 error or just plain not working.



Below is the rewrite section excerpt from my web.config file.



<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>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
</rules>
</rewrite>


I was expecting to be able to redirect http://www.example.com/join to http://www.example.com/careers but I just get a 404 while accessing http://www.example.com/join.



I have checked and the URL Rewrite module is installed and enabled.



What am I doing wrong?










share|improve this question























  • Using Failed Request Tracing to Trace Rewrite Rules | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:38











  • Testing Rewrite Rule Patterns | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:41


















4















I am really struggling with getting the 301 redirects working on our server after deploying a new website. Everything I have tried has either resulted in a 500 error or just plain not working.



Below is the rewrite section excerpt from my web.config file.



<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>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
</rules>
</rewrite>


I was expecting to be able to redirect http://www.example.com/join to http://www.example.com/careers but I just get a 404 while accessing http://www.example.com/join.



I have checked and the URL Rewrite module is installed and enabled.



What am I doing wrong?










share|improve this question























  • Using Failed Request Tracing to Trace Rewrite Rules | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:38











  • Testing Rewrite Rule Patterns | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:41














4












4








4








I am really struggling with getting the 301 redirects working on our server after deploying a new website. Everything I have tried has either resulted in a 500 error or just plain not working.



Below is the rewrite section excerpt from my web.config file.



<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>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
</rules>
</rewrite>


I was expecting to be able to redirect http://www.example.com/join to http://www.example.com/careers but I just get a 404 while accessing http://www.example.com/join.



I have checked and the URL Rewrite module is installed and enabled.



What am I doing wrong?










share|improve this question














I am really struggling with getting the 301 redirects working on our server after deploying a new website. Everything I have tried has either resulted in a 500 error or just plain not working.



Below is the rewrite section excerpt from my web.config file.



<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>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
</rules>
</rewrite>


I was expecting to be able to redirect http://www.example.com/join to http://www.example.com/careers but I just get a 404 while accessing http://www.example.com/join.



I have checked and the URL Rewrite module is installed and enabled.



What am I doing wrong?







wordpress url-redirection http-status-code-301 iis-8.5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 12:27









BurgiBurgi

202520




202520













  • Using Failed Request Tracing to Trace Rewrite Rules | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:38











  • Testing Rewrite Rule Patterns | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:41



















  • Using Failed Request Tracing to Trace Rewrite Rules | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:38











  • Testing Rewrite Rule Patterns | Microsoft Docs

    – DavidPostill
    Jan 3 at 12:41

















Using Failed Request Tracing to Trace Rewrite Rules | Microsoft Docs

– DavidPostill
Jan 3 at 12:38





Using Failed Request Tracing to Trace Rewrite Rules | Microsoft Docs

– DavidPostill
Jan 3 at 12:38













Testing Rewrite Rule Patterns | Microsoft Docs

– DavidPostill
Jan 3 at 12:41





Testing Rewrite Rule Patterns | Microsoft Docs

– DavidPostill
Jan 3 at 12:41












2 Answers
2






active

oldest

votes


















1





+200









move your 301 redirect as first rule before the wordpress rule.



<rewrite>
<rules>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
<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>





share|improve this answer
























  • This appears to be working, are you able to explain why?

    – Burgi
    Jan 9 at 10:33











  • your ".*" matches join too, and the stopProcessing stopped rule match in the first try, then you always hit the first rule in your old setting.

    – Allen
    Jan 9 at 12:58



















-1














Replace the code in your web.config file and update it with below code



 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" 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>





share|improve this answer
























  • This answer fails to address the primary issue. In fact it is a step backwards as it neglects to include the failing redirect.

    – Burgi
    Jan 14 at 9:00












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022292%2fwordpress-301-redirects-on-iis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1





+200









move your 301 redirect as first rule before the wordpress rule.



<rewrite>
<rules>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
<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>





share|improve this answer
























  • This appears to be working, are you able to explain why?

    – Burgi
    Jan 9 at 10:33











  • your ".*" matches join too, and the stopProcessing stopped rule match in the first try, then you always hit the first rule in your old setting.

    – Allen
    Jan 9 at 12:58
















1





+200









move your 301 redirect as first rule before the wordpress rule.



<rewrite>
<rules>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
<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>





share|improve this answer
























  • This appears to be working, are you able to explain why?

    – Burgi
    Jan 9 at 10:33











  • your ".*" matches join too, and the stopProcessing stopped rule match in the first try, then you always hit the first rule in your old setting.

    – Allen
    Jan 9 at 12:58














1





+200







1





+200



1




+200





move your 301 redirect as first rule before the wordpress rule.



<rewrite>
<rules>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
<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>





share|improve this answer













move your 301 redirect as first rule before the wordpress rule.



<rewrite>
<rules>
<rule name="301 Redirect 1" stopProcessing="true">
<match url="^join$" />
<action type="Redirect" url="careers" redirectType="Permanent" />
</rule>
<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>






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 8 at 16:14









AllenAllen

6,2651219




6,2651219













  • This appears to be working, are you able to explain why?

    – Burgi
    Jan 9 at 10:33











  • your ".*" matches join too, and the stopProcessing stopped rule match in the first try, then you always hit the first rule in your old setting.

    – Allen
    Jan 9 at 12:58



















  • This appears to be working, are you able to explain why?

    – Burgi
    Jan 9 at 10:33











  • your ".*" matches join too, and the stopProcessing stopped rule match in the first try, then you always hit the first rule in your old setting.

    – Allen
    Jan 9 at 12:58

















This appears to be working, are you able to explain why?

– Burgi
Jan 9 at 10:33





This appears to be working, are you able to explain why?

– Burgi
Jan 9 at 10:33













your ".*" matches join too, and the stopProcessing stopped rule match in the first try, then you always hit the first rule in your old setting.

– Allen
Jan 9 at 12:58





your ".*" matches join too, and the stopProcessing stopped rule match in the first try, then you always hit the first rule in your old setting.

– Allen
Jan 9 at 12:58













-1














Replace the code in your web.config file and update it with below code



 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" 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>





share|improve this answer
























  • This answer fails to address the primary issue. In fact it is a step backwards as it neglects to include the failing redirect.

    – Burgi
    Jan 14 at 9:00
















-1














Replace the code in your web.config file and update it with below code



 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" 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>





share|improve this answer
























  • This answer fails to address the primary issue. In fact it is a step backwards as it neglects to include the failing redirect.

    – Burgi
    Jan 14 at 9:00














-1












-1








-1







Replace the code in your web.config file and update it with below code



 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" 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>





share|improve this answer













Replace the code in your web.config file and update it with below code



 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" 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>






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 12 at 9:24









Pratik bhattPratik bhatt

428521




428521













  • This answer fails to address the primary issue. In fact it is a step backwards as it neglects to include the failing redirect.

    – Burgi
    Jan 14 at 9:00



















  • This answer fails to address the primary issue. In fact it is a step backwards as it neglects to include the failing redirect.

    – Burgi
    Jan 14 at 9:00

















This answer fails to address the primary issue. In fact it is a step backwards as it neglects to include the failing redirect.

– Burgi
Jan 14 at 9:00





This answer fails to address the primary issue. In fact it is a step backwards as it neglects to include the failing redirect.

– Burgi
Jan 14 at 9:00


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022292%2fwordpress-301-redirects-on-iis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith