Skip to content

Instantly share code, notes, and snippets.

@panoply
Last active December 15, 2015 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panoply/bbb352553464ba43635e to your computer and use it in GitHub Desktop.
Save panoply/bbb352553464ba43635e to your computer and use it in GitHub Desktop.
Force SSL Shopify

Shopify Force SSL browsing (https://)

If you' re not on [https://www.shopify.com/plus](Shopify Plus) and want SSL you need to either go through a cloud service and redirect your DNS or force SSL by checking the URL protocol with javascript and from here re-directing to https://

Please note that by forcing SSL with a javascript redirect you might run into issues and these issues might vary. Check any third parties you've got like google analytics, assets urls etc.

Read more about shopify and protocol URL's in the shopify wiki
https://docs.shopify.com/support/your-website/themes/protocol-independent-urls

// Add the following code between the <head> tags in the theme.liquid file.
if (window.location.protocol != "https:")
window.location.href = "https:" + window.location.href.substring(window.location.protocol.length);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment