How to Redirect HTTP to HTTPS on WordPress using .htaccess

Ensuring that your WordPress website uses HTTPS instead of HTTP is a crucial step for security and SEO. In this post, we'll guide you through the process of redirecting all HTTP traffic to HTTPS on your WordPress website by modifying the .htaccess file on your WordPress site. This method is both efficient and straightforward, especially when you have an SSL certificate already installed on your hosting server.

You can find the ".htaccess" file in the root directory of your WordPress installation (the same place as wp-config.php).

1. First make a backup of your .htaccess file in case something goes wrong.

2. Now Access it via an FTP client or your hosting file manager.

3. Add the following code at the top of your .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

4. Save your changes and visit your website using http://. It should automatically redirect to https://. Ensure all pages load correctly.

By adding the above code to your .htaccess file, you can now rest assured that both your users' data and your site's search engine performance are protected. If you run into any issues, remember to check for SSL certificate installation or mixed content problems to fully complete your site's migration to HTTPS.

Our WordPress Themes

Below are some of our premium WordPress themes. View all our free and premium WordPress themes →
Simple Grid PRO WordPress Theme

Simple Grid PRO

You'll be pleased with the Simple Grid PRO WordPress theme if you have tried the free version. It is a...

$25.00
GreatWP PRO WordPress Theme

GreatWP PRO

If you like GreatWP free WordPress Theme, you will love the premium version. GreatWP PRO is very user friendly, feature-rich,...

$25.00
WriteMag PRO WordPress Theme

WriteMag PRO

WriteMag PRO is improved and feature-rich version of WriteMag Free WordPress Theme. When compare with the WriteMag free version, PRO...

$25.00
BestWP PRO WordPress Theme

BestWP PRO

If you like BestWP free WordPress Theme, you will love the BestWP premium version. BestWP PRO is user friendly, feature-rich,...

$25.00
GridMag PRO WordPress Theme

GridMag PRO

If you like GridMag free WordPress Theme, you will love the premium version. GridMag PRO is an improved version of...

$25.00
RapidWP PRO WordPress Theme

RapidWP PRO

Did you try RapidWP Free WordPress Theme?, Then you will love the premium version. RapidWP PRO is an improved, more...

$25.00
GridMode PRO WordPress Theme

GridMode PRO

Are you using the GridMode free WordPress Theme and looking for more advanced features? GridMode PRO theme is developed for...

$25.00
CoolWP PRO WordPress Theme

CoolWP PRO

If you like CoolWP free WordPress Theme, you will love the premium version. CoolWP PRO is very user friendly, feature-rich,...

$25.00

Can't you choose a single theme? Purchase All Themes for $75.

Save money with our low, one-time price for access to all of our 56 WordPress themes.