WordPress: How to force my wordpress into to https using .htaccess

This tutorial will help you how to force your wordpress website into https by using .htaccess. By using this method, each time you or your visitors visit your website, by default even you did not type https at the front, it will loaded as https eventually.

How we do it?

First, you need to open your file manager of website. Please ask to your administrator or web developer if you don’t have the access to open your web files manager.

After that create .htaccess file (if haven’t created) and fill this code below after default htaccess code :

# BEGIN Force http to https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# END Force http to https

If you don’t have the .htaccess file ¬†yet, then better create it first and then paste the code I just pasted to you above.

Basically if you have a wordpress website installed, then the .htaccess file should be created first and you just need to attach above code below after default written code within .htaccess file.

Test access

After your .htaccess modified, then you can try to access your website. This time, please access your website without https at the front line. Then you can see after you type your website address without https it will start to access your website by using https eventually.

For your information, this trick is doable with website that has installed SSL certificate in advance. So if you don’t have SSL installed, then I encourage you to not use this method.

Leave a Reply

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