You are currently viewing How to redirect users from HTTP to HTTPS using htaccess?

After the SSL of your website has been generated, you will need to redirect your visitors from non-secure HTTP to HTTPS version. Here, we will show you how to do this using the .htaccess file.

After logging in to cPanel, go to file manager > public_html You will see your website files here.

By default, the .htaccess files are hidden. You can view the hidden files on your cPanel account by clicking on Settings at the top

AnyConv.com https 1 1024x502 1

and Check the ” Show Hidden Files” Checkbox then click “Save“.

Now you can create a .htaccess file by clicking on this New File Icon Give the name .htaccess make sure to start the name with (.). Click “Create New File”

AnyConv.com https 2

If you already have a htaccess file here, you do not need to create a new one. Now select the htaccess file, click on the “Edit” button from the top section. Then click on the “Edit” button again on the top button to continue, a new window will open.

On the bottom of the document, paste the following code:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Keep in mind that the RewriteEngine ON command should not be present on the file more than one time.

RewriteCond and RewriteRule command should be directly under the RewriteEngine command as given above.

Now save the document and exit.

Your website should now redirect from the HTTP version to HTTPS automatically.

If you are still seeing an SSL issue on WordPress, installing Really Simple SSL plugin on WordPress should resolve the issue.

āĻāĻ‡ āĻ•āĻ¨āĻŸā§‡āĻ¨ā§āĻŸ āĻŦāĻžāĻ‚āĻ˛āĻžāĻ¯āĻŧ āĻĒāĻĄāĻŧā§āĻ¨: āĻ•āĻŋāĻ­āĻžāĻŦā§‡ .htaccess āĻŦā§āĻ¯āĻŦāĻšāĻžāĻ° āĻ•āĻ°ā§‡ HTTP āĻĨā§‡āĻ•ā§‡ HTTPS āĻ°āĻŋāĻĄāĻžāĻ‡āĻ°ā§‡āĻ•ā§āĻŸ āĻ•āĻ°āĻŦā§‡āĻ¨?