Error Handling and Redirects 301

Error Handling and 301 Redirects. A large website with thousands of pages may be subject to URL typing or technical errors.

This could cause the request for a page that is not actually present on our server: in these cases it is necessary to create a 404 page (which indicates that the page was not found), which informs the user that the searched resource is not available and advise him to access the website from an appropriate link.


The main reasons why a Page 404 I'm:


  • broken links in writing the site;
  • page indexed in the SERPs but not present on the site;
  • links to pages or resources no longer present on the server.

Error Handling and Redirects 301

Error Handling and Redirects 301

La 404 error page it should have a layout the same as the rest of the website and provide the information necessary for the user to access our website. For this reason it could be useful to put in it a series of "entry" links to our site and possibly a contact email in case of error. In this way the user will not make the decision to leave our site but will continue to browse it.

In this regard Google provides a widget to improve the usability of the 404 error page in Webmaster tools.

When an indexed page needs to be deleted it is recommended to use the redirect 301 to tell the spider that the page in question no longer exists, but physically and permanently points to another web page. There are several ways to make an SEO friendly 301 redirect for various programming languages.



Here is a list to show the main techniques available.

htaccess 301

Htaccess 301 redirect: it can be implemented in sites hosted on Apache servers where requests are controlled by the rules specified in the .htaccess file.

Let's see an example:

Redirect 301 /pagina_seo1.php http://www.test.com/pagina_seo_ok.php

In this way the user will be redirected to the page http://www.test.com/pagina_seo_ok.php when the page_seo1.php page is requested.

IIS 301

IIS 301 redirect: IIS can be appropriately configured to manage page redirection. Let's see how to make a 301 redirect of an entire website: after starting IIS, we must select the server where the resource is present and then the website to manage. After right clicking, we choose the item Property. We select the tab Home Directory, we choose Redirect to a URL and in the box Redirect to: enter the address to which requests to be redirected. Finally, let's activate the option Permanent redirection to the required resource to redirect 301.

To redirect a single file we must follow these steps: start IIS, after selecting the server, we must move to the page to manage. We right-click on it and select the item Property. Once positioned on the board Fillet, we can change the setting in Redirect to a URL as seen above.

PHP 301

PHP redirect 301: the following code must be inserted in the page where you want to make the 301 redirect.


ASP 301

Asp redirect 301:  the following code must be inserted in the page where you want to make the 301 redirect.



<%Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, ”http://mysite.com/new.html”%>

ASP.NET 301

Asp.net redirect 301: the following code must be inserted inside the page (Page_Load section) in which you want to make the 301 redirect.

Private void Page_Load (object sender, System.EventArgs e)
{
response.Status =”301 Moved Permanently”;
response.AddHeader (“Location”, ”http://miosito.com/new.html”);
}

JSP 301

JSP redirect 301: the following code must be inserted in the page where you want to make the 301 redirect.

<% response.setStatus(301);
response.setHeader (“Location”, “http://miosito.com/new.html”);
response.setHeader( “Connection”, “close” );%>

Ruby 301

Ruby on Rails redirect 301:the following code must be inserted in the page where you want to make the 301 redirect.
def old_action
headers(“Status”) = “301 Moved Permanently”
redirect_to "http://miosito.com/new.html"
end

Coldfusion 301

Coldfusion redirect 301:

Redirect HTML

Redirect HTML: the CONTENT = 0 value specifies a 301-like redirect.

Googe and other search engines like Yahoo! they are able to recognize the redirect via meta refresh which is treated specifically as 301 (if a value of 0 is indicated) or 302 (if the delay is greater). In conclusion, the redirect via HTML should only be applied in cases where you have no alternatives, on the contrary, it is always advisable to use the 301 redirect.


Il Redirect 302 it is a temporary redirect and it is advisable to use it only in cases in which you want to communicate to the spider that a particular web page has been temporarily renamed or removed from the web, but that it will be restored shortly. In this way the spider, not finding the page, will not remove it from its index, but will keep a cached copy in memory until this web page is restored.


There are still redirects not appreciated by the engines and which, on the contrary, are interpreted as spam actions, thus penalizing the page or website. The main redirects to avoid are:

The Meta Refresh HTML: with a redirect time of more than five seconds, it doesn't seem to be a popular technique for search engines.

Javascript 301

Javascript Redirect: it falls into the cloaking category and therefore could lead to penalties for the page that implements it.

document.location.href=’http://miosito.com/nuovo.html’

Redirect con frame

Redirect con frame: typically it is used in the main page of the site where a frameset is inserted that calls a URL of the page to be displayed. This too turns out to be a technique that search engines do not appreciate.




Why is it important to use the 301 redirect

Error Handling and Redirects 301

The 301 Redirect is essential in order not to lose its popularity and PageRank, but what are the main pages to focus on at the time of a hypothetical migration?

  • the pages with the most visits
  • the best landing pages
  • the pages with the most backlinks
  • the pages best positioned in the SERP.

The steps to follow for a successful migration are:

  • avoid having two versions with duplicate content online;
  • verify that all the links of the new and old site are working;
  • implement the 404 error page to manage and control errors;
  • perform a 301 redirect globally or for each single page you want to transfer;
  • monitor operations through the Google control tool "Webmaster Tools".

By applying these steps we will be able to transfer our domain without falling into possible penalties by the search engines. To check all the internal links of our site we can use two important tools:

Xenu: is a software to install that analyzes the links of our site and the probable missing links.

Another important tool is GWT (Google Webmaster Tools). After registering, you must enter all the verification meta tags within the site to be monitored. Once you have performed these steps by going to the menu Gears Address it will be possible to transfer our domain to a new one while maintaining the popularity acquired and above all by informing Google of this change.

Other useful articles

add a comment of Error Handling and Redirects 301
Comment sent successfully! We will review it in the next few hours.