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 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....

Removing unwanted p and br tags from WordPress

When working with HTML, you sometimes don’t like your HTML editors because of the irritating automatic bugs. Yes, we are here with...

The 7 Best WordPress Plugins For Google Analytics 2020

As the saying goes, "what is not measured, is not managed." After setting up a WordPress website, it’s important to see what’s...

How to hide all WordPress update notifications in dashboard

When working on a project, it can be frustrating to have to deal with all the update notifications that are in the...

How to add custom HTML to wp_nav_menu

WordPress has a lot of features that help us solve almost all daily tasks of any programmer or web developer. Due to...

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