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;
}
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
add a comment |
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
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
add a comment |
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
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
wordpress url-redirection http-status-code-301 iis-8.5
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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>
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
add a comment |
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>
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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