SEO Friendly 301 Redirect Checker

Recently I had an issue with configuring a SEO friendly 301 redirect for a WordPress site. The reason I was trying to 301 a domain was the main domain had a few spelling variations, so I wanted to make sure all the potential users where caught and brought to the right contents. The other thing I wanted to avoid was making the site unfriendly to SEO and avoid creating duplicate entries in search engines for the same content.

What is a 301 redirect?

A 301 redirect is a permanent redirect from one URL to the other. It is very import that when a search engine comes to crawl your website it is able to follow any redirects you have set up.

How to test a 301 redirect is SEO friendly?

This tools help you determine if the redirect you have created is Search Engine Friendly.

Search Engine Friendly Redirect Check

Enter the URL whose Redirect you want to check

How to implement a 301 redirect?

There are many ways depending on what type of hosting you are using. The best thing to do is head over to Google and read up on there Webmaster section on redirects. Or below I have listed a few options…

PHP Single Page Redirect

In order to redirect a static page to a new address simply enter the code below inside the index.php file.

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/page.html");

PHP Canonical Redirect

The Canonical 301 Redirect will add (or remove) the www. prefixes to all the pages inside your domain. The code below redirects the visitors of the http://domain.com version to http://www.domain.com.

if (substr($_SERVER&#91;'HTTP_HOST'&#93;,0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER&#91;'HTTP_HOST'&#93;

Apache .htaccess Singe Page Redirect

In order to use this method you will need to create a file named .htaccess (not supported by Windows-based hosting) and place it on the root directory of your website, then just add the code below to the file.

Redirect 301 /old/oldpage.htm /new/http://www.domain.com/newpage.htm

Apache .htaccess Canonical Redirect

Follow the same steps as before but insert the code below instead (it will redirect all the visitors accessing http://domain.com to http://www.domain.com)

Options +FollowSymlinks

RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

ASP Single Page Redirect

This redirect method is used with the Active Server Pages platform.

Response.Status="301 Moved Permanently"

ASP Canonical Redirect

The Canonical Redirect with ASP must be located in a script that is executed in every page on the server before the page content starts.

If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www."
& Request.ServerVariables("HTTP_HOST")
& Request.ServerVariables("SCRIPT_NAME")
End if