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 →
PrimeWP PRO WordPress Theme

PrimeWP PRO

If you like PrimeWP Free WordPress Theme?, Then you will love the premium version. PrimeWP PRO is an more improved...

$25.00
TextWP PRO WordPress Theme

TextWP PRO

TextWP PRO is an more improved and advanced version of TextWP Free WordPress Theme. When compare with the TextWP free...

$25.00
FineWP PRO WordPress Theme

FineWP PRO

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

$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
GridBit PRO WordPress Theme

GridBit PRO

Are you looking for a feature-rich version of the GridBit Free WordPress Theme? Then you will fall in love with...

$25.00
GridFeel PRO WordPress Theme

GridFeel PRO

$25.00
GridMax PRO WordPress Theme

GridMax PRO

GridMax PRO is a feature-rich, advanced WordPress theme than its free version. If you like GridMax Free WordPress Theme, then...

$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

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.