Redirecting a domain works on HTTP but not on HTTPS with IIS server

Redirecting a domain works on HTTP but not on HTTPS with IIS server - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Redirecting a domain works on HTTP but not on HTTPS with IIS server error on your web browser. Problem :


We built a site for a client to advertise a new block of apartments they had built. The apartments have now all been sold so we have been asked to forward the domain to another domain until there is a future use for it.



We have tried to do this by setting up a 301 redirect on our server - this works great for HTTP requests (both with and without WWW) but HTTPS requests fail. Can anyone offer us any tips?



here are the 2 web config files we have tried:



WEB CONFIG 1:



<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<rewrite>
<rules>
<rule name="Redirect to http" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="HTTPS" pattern="off" ignoreCase="true" />
<add input="REQUEST_URI" pattern="(/w*[/ | w]+.aspx)" />
</conditions>
<action type="Redirect" url="http://HTTP_HOSTREQUEST_URI" redirectType="Permanent" appendQueryString="false" />
</rule>

</rules>
</rewrite>

<location path="index.html">
<system.webServer>
<httpRedirect destination="https://WEBFORWARDINGDOMAIN.co.uk/" />
</system.webServer>
</location>




WEB CONFIG 2



<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="index.html">
<system.webServer>
<httpRedirect enabled="true" destination="https://WEBFORWARDINGDOMAIN.co.uk/" childOnly="true" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>

Solution :

WEB CONFIG 1



change rewrite action url protocol to HTTPS and add new forwarding domain (redirects 1:1 -- http://old-domain.co.uk/link <> https://WEBFORWARDINGDOMAIN.co.uk/link)



<action type="Redirect" url="https://WEBFORWARDINGDOMAIN.co.ukREQUEST_URI" redirectType="Permanent" appendQueryString="false" />



or redirect all requests to https://WEBFORWARDINGDOMAIN.co.uk/ homepage



<action type="Redirect" url="https://WEBFORWARDINGDOMAIN.co.uk/" redirectType="Permanent" appendQueryString="false" />


We hope that this article has helped you resolve the redirects, 301-redirect, https error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

Redirected urls show in serp, with the original permalink but with the title and meta of the target page

How can I redirect everything but the index as 410?

How do I redirect traffic only if being accessed from a specific port?