<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d29653863\x26blogName\x3dPro-SEO\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dSILVER\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://pro-seo.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://pro-seo.blogspot.com/\x26vt\x3d5666858755316451389', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
« Pro-SEO Home || How Google Rank Videos » || Alt Attribute Importance In SEO » || Adsense Secrets - Earn More with Adsense » || SEO Terms »

301 permanent Redirect


There comes a time in every webmasters life when they need to redirect a user to a different page. This could be because you have moved your pages around to improve your sites structure, Or because you have deleted a page and don't want your visitors to see a 404 error message.

Now, the safest way to redirect visitors and bots is to use a permanent 301 redirect, A permanent 301 redirect sends a status code to the browser, or bot, to inform them that this page has moved, and is not coming back and that there is a new replacement page they should be looking at. We call this the safest way to redirect users because spider bots understand this status code, they will follow it and eventually pass over rank to the new page.

In this small tutorial we will cover the various ways you can achieve a 301 redirect using different languages and different methods.

Redirect visitors and bots from a subdomain to a domain with a 301 redirect


New webmasters are told to only point links to one place, It is important that all of your backlinks go to the same URL.
Remember, www.domain.com domain.com, www.domain.com/index.html and domain.com/index.html are not the same page, they will be seen as different pages,, and in the case of WWW Vs non WWW they will be seen as different websites.

This can partly be overcome by using a 301 redirect to send visitors and spider bots who go to domain.com to www.domain..com, And we achieve this with an .htaccess file that sends a 301 redirect status..

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]



Or if your host doesn't allow mod_rewrite, You can use this code in an .htaccess file

Redirect 301 http://domain.com/oldfile.html http://www.domain.com/newfile.html



PHP 301 Redirect


You can also send a 301 status code with PHP. To do this, put the following code in the PHP file you wish to redirect from.

header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.domain.com/newpage.html");
exit();



ASP 301 Redirect


finally we will look at the ASP 301 redirect, That is achieved with the following code in your ASP file.

<%@ Language=VBScript %>
<% Response.Status="301 Moved Permanently" Response.AddHeader "Location", "http://www.domain.com/newpage.asp" response.end %>

| Alt Attribute Importance In SEO »
| Adsense Secrets - Earn More with Adsense »
| SEO Terms »

Posted by Anonymous Anonymous @ Friday, 01 September, 2006

The ASP redirect could look something like this:

(easiest way is to put it in the global.asa)

If Request.ServerVariables("PATH_INFO")= "/oldfile.htm" Then

Response.Status="301 Moved Permanently"

Response.AddHeader "Location", "http://www.domain.com/newfile.htm"

End if  



Post a Comment