How to Redirect All Pages to Homepage.

How to Redirect All Pages to Homepage?

There’s a situation where you want to redirect all pages to homepage but don’t want to lose the clients, SEO ranking, and traffics. The different types of redirects can be applied. You have to choose the best and most simple way which ensures a safe way of redirecting.

In this article, we want you to understand fully what a 301 redirect and how it makes your site work after redirect and what exactly you need to do.

Difference of 301 and 302 Redirect:

 302 (Temporary) Redirect:

Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date.

301 (Permanent) Redirect:

Use a 301 redirect .htaccess to point an entire site to a different URL permanently. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the “example.com” domain.

What is a 301 Redirect?

A 301 is one of the HTTP status codes sent by a web server to a browser and one of the most commonly used for redirect purposes. It signals a permanent redirect from one URL to another, i.e., all users that request an old URL will be automatically sent to a new URL. A 301 redirect passes all the ranking from old to new URLs.

Simply that, after moving a piece of content from a specific URL without redirecting it, anyone who tries to visit it will show a 404 error – page not found. Now, if you attempt to visit the moved URL after being redirected, the server will send back the 301 – Permanently Moved status code, and then take you to the new URL.

Why Need A 301 Redirect?

  • Allows you to redirect all pages to homepage or redirect from multiple links to one specific link.
  • Enables an easy flow transition.
  • Protects and transfers all your website’s current backlinks from the old site to the new site.
  • Allows web pages in the new site to be indexed easily.
  • Less chance of negative impact on user traffic.

How long does a 301 redirect last?

A permanent HTTP 301 usually lasts for around a year or longer. After that, make sure to check if users are still sent to your new URL or update it.

Check the steps below for safe redirect:

1.    Backup Your Website

2.    Ensure your HTTP version redirects to your HTTPS

3.    Remove 301 redirects from your sitemap

4.    Avoid redirect chains and Fix redirect loops

5.    Fix your broken redirects

6.    Replace 302 redirects with 301

7.    Check for 301 redirected pages that receive traffic.

8.    Check Your Htaccess Files for Errors in URL Linking

Here we set a single redirect to understand the process. If you want to redirect all pages to the home page or multiple redirects, you can mention one by one as below:

“redirect 301 (source)              (destination)”

Here,

Source – Redirect the visitors to another URL if they visit here (typically a 404 Page).

Destination – where you want the visitor to land if they visit the Source URL.

 

Methods of 301 redirect

Redirect 1: .htaccess redirect all pages to homepage within a domain

I have one page on my website. So added redirect only one to the home page. If you want all the pages redirect to the home page on your website you can add a list one by one.

  • Login to CPanel of your website -> File manager -> public_html
  • Right-click and edit .htaccess file
  • Paste the below code inside the file and save it.

redirect 301 /sports                         http://checking.com

Place the code as shown in the picture below:

redirect all pages to homepage

Redirect 2: .htaccess redirect from domain to domain

  • The same process like above but change the code as below:

redirect 301 /                            http://www.google.com

Place the code as shown in the picture below:

302-redirect-htaccess

Important Note: Take a backup of the original file before redirecting. As if it fails you can retry and complete the process correctly.

Redirect 2: Using Cpanel

You can also add a redirect by accessing the Cpanel and following the steps below.

  • Login to Cpanel -> DomainscPanel
  • Click the Manage optionRedirect-manage
  • Click Modify the Redirect option.Modify-redirect-option
  • In types, choose Permanent 301 as we are going to move the page permanently.Add-Redirect
  • In the Redirects to box, type the domain name or page name where you need your website to redirect.
  • In the box “ / ”, type the page which needs you to take to the page which you mentioned in the “Redirect to” Box.Example as below where we made a redirect to “google.com” if anyone tries to visit our website “checking.com”,Adding-Redirection
  • You can see the list of redirects you made in using Cpanel and also through .htaccess