Hello, today we will force our WordPress site to use HTTPS instead of HTTP
You can use plugins or something else but the proper way to force your site to use HTTPS is by editing the .htaccess file.
In fact, doing something wrong with .htaccess can cause your site to crash and more
So let’s start our Guide
If you set up your WordPress your .htaccess should look like this
But adding a simple sentence can force your site to use HTTPS
This is an example:
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://yoursiteurl.com/$1 [R=301,L]
Note - only one RewriteEngine on can exist in your .htaccess code !
Finally, there are a lot of ways to force your site to use HTTPS, but I will show the way that redirects to HTTPS you can use Cloudflare but this can be enough to force your site to use HTTPS
Don’t forget you need an SSL certificate to use HTTPS.
Have a nice day hope you force your site to use HTTPS
I showed how to force your site use https without using plugins.
Thanks, who don’t want to edit .htaccess can use plugin but don’t forget you can force your site use htttps without using plugins.
Another way will be to use InfinityFree SSL tool to install SSL cert. Then add the custom domain to CloudFlare. Last step will be to change SSL mode to full or full(strict) within CF. No .htaccess modification will be needed.