.htaccess Tutorial : How to Redirect http to https using .htaccess

htaccess Tutorial : How to Redirect http to https using .htaccess

Basically, http stands for Hypertext Transfer Protocol is used to define or make a data or information sharing platform between the server and clients of WWW ( World Wide Web ). Now we talk about https and what is the SEO benefits of https secured URLs and also discuss the major difference between http and https. So first to talk about the what is https ??



What is https ??

full form of https is HyperText Transfer Protocol Secure and it also stands for the secure way to access the sensitive data or information from one server to another server or serve the sensitive information or data between the server or client. In simple words, we can say it is the secure way for the every internet users.

Is https benefit in SEO ?

it is the common question of every newbie users who are working in blogging or web development field and they want to know is https benefit in SEO of their Website or Blog and here my answer is Yesss :). https is most beneficial in SEO and nowadays the Google algorithms updates with time and now the time is changed and now people wants a more secure place to visit or surf the secure things over the Internet and if we talk about organic search results then google is drive mostly organic traffic on your website or blog. And now if want to rank in the first page of search results of Google Search Engine then you need an own https secure website or blog. Because sometimes ago some changes in their algorithms and according to these changes you need and SSL secure or https URL for your blog and website to rank on the first page of Google Search Results.

Major Difference Between http and https

  • http is an insecure way to get access to the sensitive information or data
  • https is a secure way to get access to the sensitive information or sensitive data
  • As the Google algorithm updates now the http URL represent the not secure website for internet users and that’s the reason your website or blog does not rank on the first page in google search results
  • And in terms of https google algorithms define the secure website or blog for internet users and here google easily rank up on the first page of search results
  • If you sell or share some sensitive information or data with your website or blog users then http is not good for your website or blog
  • And in terms of https your website or blog totally safe from the many types of attack and here you can share or sell any sensitive information or data to your website or blog users

Note :-

Before to follow this step you need to install an SSL certificate on your website or blog. Because without an SSL certificate you cannot access authorized as https for secure website or blog. If you don’t know how to setup a free SSL Certificate on your website then click on the below article link and setup a free SSL certificate on your website or blog.




Read an article about: how to set up a Free SSL certificate on your website

.htaccess Redirect : How to move your website or blog from http to https by using custom .htaccess

Follow the Steps: How to move http to https using .htaccess

STEP 1:-

In this step, you need simply open your Cpanel account and you will see here an option of file manager then simply click on it and open File Manager

STEP 2:-



Now you will enter in the file manager of your web hosting panel and now you need to go into the public HTML folder of your file manager and then you need to find or create a new .htaccess file in your public HTML folder

STEP 3:-

If .htaccess file also in your file manager then you will not need to create a new .htaccess file then you need to just edit this .htaccess file or if the .htaccess file is not available in your file manager then you just need to create a new .htaccess file in your public HTML folder and follow the last step of the how to redirect http to https using .htaccess and complete this .htacess tutorial

STEP 4:-

Here I’m writing custom .htaccess code for redirect HTTP to https and here you need to just copy this code and put into your .htaccess and simply save this file and simply smile 🙈😂 Now your website or blog successfully redirect HTTP to https and now you need change your website or blog URL in the search engine. so now go into your search console and fix this !! And enjoy it.☺️

.htaccess custom Code

301 Redirect of http://example.com to https://www.example.com

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

302 Redirect of http://example.com to https://www.example.com

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

 

 

Hopefully, you like this post and don’t forget to share on your social media platforms and also don’t forget to subscribe to our blog for more .htaccess tutorials and much more about the website and blogging tips



About Ashok.cse

Hi, I'm currently studying for the Bachelor of Technology In Computer Science from Rajasthan Technical University. I am the web developer with 3+ years of experience. my range of developer services including creating the design for new apps and web platforms or building UI design for mobile, tablets or desktops. making UX designs wireframes and layouts concepts and redesigns websites are adapting to mobile and responsive design. I have worked with many clients. I am working professionally with WordPress And Adobe tools.

View all posts by Ashok.cse →

Leave a Reply

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