You are here: Blog » Code Snippets » Force https://www

Force https://www

lf

Suppose that you have a website and the URL is https://www.mysite.com and you want to make it so that no matter what URL your website visitor uses for your site, they always end up at the https://www version of your site. For example mysite.com.com/page would become https://www.mysite.com/page, www.mysite.com/page would become https://www.mysite.com/page, https://mysite.com/page would become https://www.mysite.com/page, etc. The code below will show you how to achieve this. Note that the code should go in the .htaccess file in your root folder.

The Code

This entry was posted in Code Snippets and tagged by .

Author: justin saad

Justin Saad is first and foremost a husband and a father of four. He is also a web developer and designer who has been making websites for over twenty years. His company is called The Motech Network and his website is ClevelandWebDeveloper.com. In addition to building websites, Justin makes WordPress plugins and likes writing tutorials to help others learn about various aspects of web development.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">