0

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_HOST}{REQUEST_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>
  • 1
    For SEO purpose you should use a 302 redirect here, not a 301. – Michael Hampton Jan 16 at 16:03
  • Have you tried redirecting to a https site? – jdog Jan 16 at 18:48
1

Both of your configurations are applying the HTTP Redirect on the index.html file directly. This effectively causes the redirect to only happen if someone goes directly to http://yoursite.co.uk/index.html or https://yoursite.co.uk/index.html.

Try the following in your root web.config and take out the IIS URL Rewrite rule that you have.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpRedirect enabled="true" destination="https://WEBFORWARDINGDOMAIN.co.uk/" />
    </system.webServer>
</configuration>
  • Thanks @Tim Liston, I've changed the web config to the above but still no luck i'm afraid. its doing the same thing (site cant be reached error with https) – Paul Jan 17 at 10:05
  • 1
    Do you have an HTTPS binding on the site with a valid certificate? – Tim Liston Jan 17 at 17:14
  • Thanks @tim a combination of certificate and the above config did the trick – Paul Jan 24 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.