Do you want to redirect your website from HTTP to HTTPS? Don’t worry! Today, you will learn how you can easily redirect HTTP to HTTPS using .htaccess file.
Are you ready?
If yes then you just need follow this guide step by step in order to redirect your website from HTTP to HTTPS.
Let’s start the topic.
Steps to redirect HTTP to HTTPS using .htaccess file :
Here are the steps you need to follow one by one so that you can also able to redirect HTTP to HTTPS.
STEP 1 – Login To Your cPanel Account
- Go to ShoutCoder.
- Login your Account.
- Click on SERVICES.
- Select your Active Product/Services.
- Click on “Login to cPanel” under Action Tab.
- Or, click on the login to cPanel button just below the nameservers.
- Then you will automatically redirected to your cPanel Account.
Or, If you have cPanel login details then you can easily login to your cPanel account by visiting yourdomain.com/cpanel.
STEP 2 – Go To File Manager
- Search “File Manager” in the search bar.
- Or, Look at the first one, that is it.
- Click on the File Manager.
- Wait for the next page.
- Now, Click on “public_html” folder.
STEP 3 – Edit Your .htaccess File
- If you don’t find .htaccess files then follow this to unhide it –
- Go to Settings present at the top right corner.
- You will get a popup soon.
- Here, you need to tick “Show Hidden Files (dotfiles)” option.
- Then, click on the “Save” button.
- Done! You will able to see .htaccess file.
- Now, right click on .htaccess file.
- Then, click on Edit button.
- If you get a popup then again click on the “Edit” button.
- You will now redirected to a next page.
Now, copy the following code which is mentioned below :
RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
- Paste the code at the top of .htaccess file.
- Then, click on “Save Changes” at upper right corner.
- You will now get a success message at lower right corner like this :
- Done!
- Now, you can click on “Close” button at upper right or can simply close the tab.
- At last, check that the redirection is working fine.
- All set, you are good to go.
Thanks for reading this article. Hope, your doubt regarding how to redirect HTTP to HTTPS using .htaccess file is now completely resolved.
If you still have any doubt then please let us know through the comments.