Avoid landing page redirects – Google Page Speed Insights

Web Site Speed

This is part of our guide on improving page speed using the Google page speed insights developer tool. In this article we are discussing the Avoid Landing Page Redirects section. We will be writing this article for novices using plain English and attempting to add a little more light to the explanation given by Google.

 

What is the landing page?

To explain how to avoid landing page redirects I will first explain what the landing page and redirects are.

The landing page is the first page seen by a user when they type in your sites URL. This is often the index page (or Homepage) but can be anything you desire.

What are redirects?

 

If a site owner wants to change a page that the user sees and replace it with another page or site that already exists they can redirect that page.

 

 

The Problem with Redirects

 

Despite the wording ’avoid landing page redirects’, redirects are fine and common practice but it’s the method used that may have significant effect on the load speed of a page.

Client Side Redirect

 

The wrong way to redirect a page is to add code to that page that does the redirecting. This is known as ‘client side redirection’ and is a problem because the user has to wait longer for the page to load.

Avoid landing page redirects

Normally the user selects a website and this request is sent to the server. The server then sends back the code for the webpage which is assembled and displayed by the user’s browser.

If the webpage includes the command to redirect then once the site has been sent to the users browser, the redirect is read and then another request is made to the server for the required web page. And while this repeated request is being made the user is left with a blank screen.

But there is an alternative.

Server Side Redirect

 

A redirect command can be added to a file which remains on the server. That way when the user requests the site, the server already knows to correct page to send back and this cuts down the amount of requests.

To do this you need to know the type of server you are using and you can get this information from your web host. What you want to know is whether your site is run on apache or windows servers.

 

Apache Servers

 

The majority of websites are run on Apache servers and that being the case you can give your server certain commands using a ‘.htaccess’ file.

To create your .htaccess file you can use any code editor or even notepad.

Using notepad you can simply create a new file and enter the following.

First we turn on the redirect engine which is done with the simple line RewriteEngine On. This command is only input once in the file, no matter how many redirects we want to do. Then on a new line enter

Redirect 301 /old-page.html http://www.mydomain.com/new-page.html

 

The “Redirect 301” is the command and states that this is a permanent redirect. Google will pick up on this also and use it accordingly for SEO purposes. Alternatively you can use a ‘Redirect 302” which states that it is a temporary redirect. In this case Google makes no change to backlink attribution etc.

After entering “Redirect 301” you must leave a space then a forward slash followed by original page you wish to redirect. So in the case of your homepage it would generally be ‘/index.html’. Finally you leave another space and enter the entire path of the new page you want to redirect too.

If you wish to redirect more pages you just simply enter the “Redirect 301 on a new line followed by the links as stated above. You can even redirect the entire site with just a few lines of code but we will cover that in another article.

Saving your .htaccess file for the first time

 

To save your .htaccess file for the first time you need to go to file and then save as. In the File Name field enter “.htaccess” (including the speech marks as shown in the image) and press save. That’s it you have created your .htaccess file and from now on you can just save that file in the normal way. If you didn’t include the speech marks then notepad would just create it as a text file which couldn’t be read by the server.

The next task is to upload the file into the top directory of your site using an ftp client such as Dreamweaver or Filezilla.

 

Redirects using Windows Servers

 

There are various methods to implement URL redirects on windows servers including using the web.config file, or using Microsoft’s URL Rewrite

We hope you found this guide to avoid landing page redirects useful and if so you may find more articles in the series helpful. For more in the series please click on the link below.

This is part of our guide on improving page speed using the Google page speed insights developer tool.