Rich-text Reply

how to test http vs https

aukev 01-29-16

how to test http vs https

I`m trying to figure out how to test the regular http vs the https version of my site. Don't seem to be able to get it working. Any ideas?

 

 

Level 2

robertchan 01-29-16
 

Re: how to test http vs https

[ Edited ]

Depending on your site framework, you can refer to the following:

 

http://stackoverflow.com/questions/5491196/rewriting-http-url-to-https-using-regular-expression-and-...

 

http://stackoverflow.com/questions/17277746/how-to-replace-http-with-https-via-javascript

 

However, as one commentor mentioned, "It is not (a) good idea because you just temporar(il)y redirect (the) user to https and (the) browser doesn't save this redirect.".

Robert Chan

Experimentation Hero
aukev 01-31-16
 

Re: how to test http vs https

[ Edited ]

Hi Robert, thank you for your reply. I already have a http and a https  version of my website, and the htaccess code to permanently redirect to the https version is ready and waiting too. I just want to run a quick test before I switch completly.

 

Any idea how I can best put this into an AB test using optimizely?

Level 2
aukev 01-31-16
 

Re: how to test http vs https

I think I managed. I`d like to hear your opinion on this:

url targeting to substring match: www.domain.com

For the variation I added a custom redirect by adding this to the variation code:
/* _optimizely_redirect=http://https */
$("head").append("<style>body{display:none;}</style>");
var oldURL = window.location.hostname + window.location.pathname;
var newURL = "https://" + oldURL;
window.location = newURL;
Level 2