13.9 C
New York
Saturday, April 20, 2024

How to Redirect Http to Https with .htaccess file

How to Redirect Http to Https, might be your site have serval issues but “all versions of your page point is not at the same URL”. Here we will fix this issue with the help of the .htaccess file.

This is very simple you just need to create a .htaccess file and add in Cpanel. Might be this method will be difficult for you. But don’t worry there are two methods in which you can add this file or code.

Let me explain how this issue is created:

Your Site is not set on the Same URL

How much your site daily visitor? Doesn’t matter, there is a various visitor for your site that search daily with different URL. The examples are mentioned below:

  • https://example.com/
  • http://example.com/
  • https://www.example.com/
  • http://www.example.com/

that is essential for your site when someone searches your site with a different URL, must be open with one URL. Such as someone search http://www.example.com must be open with https://exmaple.com.

Why it is essential for all versions of your page point is at the same URL? Because according to Google search engine these are different URLs that are mentioned above. You need to set all URLs on the same point.

For example, your site’s main URL is https://example.com/ then you need to redirect all other URLs to this URL. Otherwise, someone searches your site with a different URL so Google considered that traffic from your non-preferred domain.

How to Check Redirection Issue

You need to open the WooRank site, or you need to add the WooRank Google chrome extension in the chrome browser. Then open the site and click on the WooRank icon.

You will see that there will be show all information about your website. So you need to scroll down and check the indexing part as mentioned in the image.

How to Check Redirection Issue

How to Fix Redirect issue?

There are two methods which you can solve this problem easily:

  • Redirect URLs with a .htaccess file in Cpanel
  • Redirect URLs with a .htaccess file in WordPress Dashboard

But before this, you need to create a .htaccess file for redirect URLs. How I can create a .htaccess file for the redirect?

You need to open Redirect Generator, and follow these steps that are mentioned below:

  • Enter Domain name
  • Select HTTPS (Note: if you are using HTTP then select HTTP)
  • Don’t change other settings (Trailing Slash Settings)
  • Redirect www to root domain “select Yes” (Note: if you are using www already then select NO)
  • Then click on Generate .htaccess
  • Now your .htaccess file is ready

Generate htaccess file

Redirect URLs with a .htaccess file in Cpanel

Follow the following steps that are mentioned below for redirect URLs:

  • Login Cpanel
  • Click on the file manager
  • Right-click on .htaccess file and edit
  • Copy the .htaccess code that we generate in the above section
  • Paste .htaccess code at below in .htaccess file
  • Click on save changes
  • Now your site URLs are redirected to the same URL

How to Fix Redirect issue

Redirect URLs with a .htaccess file in WordPress Dashboard

Follow the following steps that are mentioned below for redirect URLs:

  • Open dashboard
  • Click on SEO
  • Go into Tools in SEO
  • Hit on file editor
  • Go into the .htaccess file
  • Paste .htaccess code at the below in .htaccess file
  • Click on save changes

Final Words

Search engines see www.example.com and example.com as different websites. This means they could see a large amount of duplicate content, which they don’t like. Fortunately, your website redirects www.example.com and example.com to the same site.

If still, you have any confusion related to content. Here is a video mentioned that can help to redirect solve.

blogili
blogili
Blogili is the premier and most trustworthy resource for technology, telecom, business, auto news, games review in World.

Related Articles

Stay Connected

10,000FansLike
5,000FollowersFollow
10,000SubscribersSubscribe
Google News Follow Button

Latest Articles