- 0
301 Redirect Question
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
Google to discontinue the Basic HTML version of Gmail next year
By Chasethebase,
- 1 reply
- 4 views
-
Get this Price Dropped Coding 101 Bootcamp Beginners Bundle for only $24.99
By News Staff,
- zenva academy
- coding 101
- (and 11 more)
- 1 reply
- 6 views
-
Bid under $10 for this full Superstar Web Development & Design Bundle
By News Staff,
- neowin deals
- pay what you want
- (and 12 more)
- 0 replies
- 7 views
-
This Master Learn to Code 2021 Certification Bundle is Price Dropped to just $20
By News Staff,
- neowin deals
- online courses
- (and 18 more)
- 0 replies
- 4 views
-
Pay What You Want for a 20-Course Programming Bundle
By News Staff,
- neowin dewals
- pay what you want
- (and 17 more)
- 0 replies
- 4 views
-
Question
M_Lyons10
Hi everyone.
I am trying to do a 301 Redirect and each time I attempt to do so I somehow mess it up and make the site unavailable...
So, I wanted to ask on here what I'm doing wrong and how I can do this. I have a web.config in my site directory and everything else seems to work (I have it redirecting to an error page if the page isn't found, etc.).
But the 301 I've had a lot of issue with.
Here is my web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rule name="www redirect" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^[^\.]+\.[^\.]+$" />
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" />
</rule>
<rule name="www redirect https" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^[^\.]+\.[^\.]+$" />
<add input="{HTTPS}" pattern="on" />
</conditions>
<action type="Redirect" url="https://www.{HTTP_HOST}/{R:0}" />
</rule>
<defaultDocument enabled="true">
<files>
<clear />
<add value="index.aspx" />
<add value="index.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="home.aspx" />
<add value="home.asp" />
<add value="home.htm" />
<add value="home.html" />
<add value="default.aspx" />
<add value="default.asp" />
<add value="default.htm" />
<add value="default.html" />
</files>
</defaultDocument>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/moved.html" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
So, what do I put where? lol I REALLY appreciate the help.
-Matt-
Link to comment
Share on other sites
5 answers to this question
Recommended Posts