Welcome to WebmasterWorld Guest from 34.204.203.142

Forum Moderators: ocean10000

Message Too Old, No Replies

Best way to redirect HTTP to HTTPS

     
3:24 pm on Jun 20, 2016 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 18, 2002
posts: 145
votes: 0


Hi gents,

IIS 8.5. I would like to understand the best practice to redirect every HTTP get to HTTPS.

Up to now, I created 2 websites, site (80) and site (443). The site (80) is only a placeholder for users that insert website address www.mysite.com and uses HTTP redirect (with 301 status) to site (443) that is the whole site.

However I suspect that the above strategy is bad for analytics.

Can you please suggest your solution ?

Thanks
4:17 pm on June 20, 2016 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Apr 30, 2008
posts:2630
votes: 191


What you did seems fine to me.

Do you use canonical link element? If so, it should point to https:// version.
Also, I hope that google and other search engines have indexed https version?

Regarding analytics, modern browsers will preserve referrer and your analytics should only kicked in on the https version of the page site since the analytics code on http version of the page should never be executed as the page is not returned, only 301 headers are returned instead.

Or do you have some other concern with regards to analytics?
8:19 pm on June 20, 2016 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 889


I created 2 websites

Do you mean that you have two separate sets of physical files? Whether you do or don't should make absolutely no difference if the 301 redirect is correctly configured, because nobody, ever-- no, not even the googlebot-- will be able to set foot on the http site.

I suspect that the above strategy is bad for analytics

Did you mean that you want analytics to reflect the fact that some people typed in "http" by mistake for "https"? That's tricky, unless you let people arrive on the "wrong" page before doing an in-page redirect to the "right" page. And frankly that's a pretty bad idea in most situations.

Incidentally: is any part of your question specific to IIS? I shouldn't think so. The exact wording in your config file will look different, but all underlying principles are the same regardless of server type.
7:23 am on June 21, 2016 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 18, 2002
posts: 145
votes: 0


I ended up with this solution [meltedbutter.net...] works like a charm and is native for IIS.

Thank you for the explanation regarding the referrer preserved even after a 301: this is pretty much what I wanted to know. I was concerned about the fact that a user, reaching my website inserting http://www.example.com won't have been tracked by analytics due to redirect.

Lucy, it is strictly related to IIS because I tried either HTTP redirect IIS feature (https://technet.microsoft.com/en-us/library/cc732930(v=ws.10).aspx) and URL rewrite for IIS, downloaded from MS link, that you can find in the first link I posted.

Thanks both for help.

[edited by: bill at 3:55 am (utc) on Aug 31, 2016]
[edit reason] use EXAMPLE.COM to prevent auto-linking [/edit]