How to redirect HTTP to HTTPs in .htaccess

Today’s standard is to have an https certificate. Google will love you if your sites are secured. So https is not standard, it’s must-have! Easy way to make your website secured is making a redirect from HTTP to HTTPS in the .htaccess file.

33.2% of Alexa top 1,000,000 websites use HTTPS as default, 57.1% of the Internet’s 137,971 most popular websites have a secure implementation of HTTPS, and 70% of page loads (measured by Firefox Telemetry) use HTTPS. Statistics are from April 2018.

Source: Wikipedia

Redirect HTTP to HTTPs in .htaccess

Using this code to successfully redirect your domain from http to https is the easiest way:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Using the 301 'permanently moved' redirect will help transfer your SEO rankings. To redirect using the 302 'temporarily moved' change [R=302,L]

Redirect HTTP to HTTPs with a plugin in WordPress

If you are not familiar with .htaccess, you can use a plugin Really Simple SSL. The plugin has no complicated settings, but for this problem it’s overkill.

Recent Articles

How to Bulk Delete Media in WordPress

WordPress and media. That's the topic for a book. Sometimes is not easy to find what you need and when you have...

Custom Order Number for WooCommerce Will Saves You a Lot of Hassle!

WordPress is still the king of Content Management Systems (CMS). Thanks to its open-source nature, millions upon millions of users and PHP...

How to Manually Sort WooCommerce Products

WooCommerce is an e-commerce plugin for WordPress. It is a great way for the user to create an online store for their...

How to Delete All WooCommerce Products

Remove all WooCommerce products is a good thing, especially when you have got thousands of products and need to make your site...

How to bulk delete WordPress comments in PHPMyAdmin

Any user working on the computer system has the option in quickly deleting all the WordPress comments by using MySQL or phpMyAdmin....

Get in touch

Be our first-class reader, build a community and follow us on social media!

Leave A Reply

Please enter your comment!
Please enter your name here