How to Make Website Always Use HTTPS

How to Make Website Always Use HTTPS

Always Use HTTPS will redirect all http requests to website into https address. The Auto Rewrites changes the links of website to be HTTPS as well.

Go to website’s root directory

Either use cPanel or file explorer.

Open .htaccess file

It may be hidden or not exist yet. Change cPanel settings to show hidden files. If the file doesn’t exist yet, create one.

Add 4 lines of code

Copy and paste the code highlighted below on line 8-11.

Save and Close

Make sure to save it.

# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

<IfModule mod_rewrite.c>
RewriteEngine On
# Always https - Start
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Always https - End
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

What do you think?

Leave a Reply

Your email address will not be published.

WP Schema Pro

WP Schema Pro 2.2.3