2

Ages ago we included a redirect in web.config to ensure that pages would rewrite to http://www.example.com/ if the user input, say, www.example.comor variants of it.

Recently we changed the site so its (finally) going to HTTPS. So the rewrite should do the same but this time to https://www.example.com/

We used this, note it's permanent:

<action type="Redirect" url="http://www.example.com/{R:1}" redirectType="Permanent" />

As it was permanent, what happens if we change that to HTTPS?

2

When you use a 301 (permanent) redirect, the browser caches this redirection and uses it further on. So the change won't be visible for people that have already visited the URL before since they are going to be redirected to the HTTP version that you used in the first place. New visitors will follow the new redirection.

However, a best practice is to force the use of HTTPS for your domain, so I would add a rule to force all HTTP requests to HTTPS (if I'm not wrong IIS URL Rewrite, out of the box, has a template to do that). In that case people that have the old redirection cached won't notice the new one but will end up in HTTPS anyway. It will work with any external link you have pointing to HTTP, etc.

  • So this redirect is not the same as a 301 which can be a real hairball to untangle? From an SEO standpoint, fudging up a 301 is Very Bad. So an IIS rewrite although you say it's permanent, it can be re-"permanented". If that's confirmable, then the answer is fine that you gave. Because the issue also involves this: did permanent redirect from pagename.htm to pagename.asp, Permanet as http. Now need to do pagename.asp redirect from http to https. Do I leave or remove the old .htm to .asp -- that seems wrong to leave them. – SKidd Aug 5 at 11:03
  • Yes, it's permanent, but in fact, if you hit the HTTP URL and found a new 301 redirection to the HTTPS URL, it's a new permanent redirection and therefore will work correctly. I mean: a user that has already visited example.com/pagename.htm and got redirected to example.com/pagename.asp, will go directly to this URL, but when trying to download it, they will find the new redirection and will get get a 301 redirection to example.com/pagename.asp, achieving what you want. – jalarcon Aug 6 at 7:51

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.