Technology

How to redirect a website from HTTP to HTTPS using htaccess file

Since certain browsers starting displaying errors on sites without SSL certificates is more important now then ever to install SSL’s on your website the simple code below will show you how how to redirect a website from HTTP to HTTPS using htaccess file.

To redirect the new site download the .htaccess file from your root folder in your sites FTP and add the code below to it. Once your done upload the new .htaccess file and your site should be redirecting to the new https: site instead if http:

Code to redirect site in htaccess file:

# BEGIN 
# The directives (lines) between "BEGIN " and "END " are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?bluetowersfg\.com
RewriteRule ^(.*)$ https://bluetowersfg.com/$1 [R,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

And here if you should been able to redirect a website from HTTP to HTTPS using htaccess file

Like what your see, Follow Us on Social Media
About the author

Code for the Culture

Code for the Culture is a company that specializes in merging the concepts hip hop, design, and technology. Our online resource focused on displaying the most up to date new and golden age hip hop, art/design, and technology. Much about Code for the Culture is through our development and design parent company CodeCuz (Learn more about CodeCuz)

Leave a Reply

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