How to Implement 301 Redirect?
301 redirect is the most common need for basic search engine optimization nowadays. The most efficient way of redirecting a web page is 301 redirect. It’s not that hard to implement 301 redirects. Let’s learn about how to implement 301 Redirect? It’s the safest option to maintain your rankings on Search Engines if you moved/renames your website pages OR domain name. “301 Redirect” is interpreted as “Moved Permanently”.
As I said, 301 redirect is not a hard job to implement. You can do it easily but yes, it’s important to know which technology your website is developed. There are several technologies OR we can say programming languages available in the market like ASP, PHP, Coldfusion, HTML etc… So you should know that first.
Now, what to do after that? Nothing!!!! Really?? Yeah!
Lol. You must be surprised but I mean what I said.
Let me make it very simple for you to learn how to implement 301 Redirect?. Below I’m giving a collection of all the 301 redirection setup codes for all the technologies/programming languages. So just pick the code from below based on your website technology and implement it on your website and you’re done.
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
Redirect Old domain to New domain (htaccess redirect)
Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain. The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Please REPLACE www.newdomain.com in the above code with your actual domain name.
In addition to the redirect, I would suggest that you contact every backlinking site to modify their backlink to point to your new website.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite module enabled.
- In internet services manager, right click on the file or folder you wish to redirect
- Select the radio titled “a redirection to a URL”.
- Enter the redirection page
- Check “The exact URL entered above” and the “A permanent redirection for this resource”
- Click on ‘Apply’
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com">
Response.Status="301 Moved Permanently"
ASP .NET Redirect
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";
JSP (Java) Redirect
response.setHeader( "Location", "http://www.new-url.com/" );
response.setHeader( "Connection", "close" );
CGI PERL Redirect
$q = new CGI;
Ruby on Rails Redirect
headers["Status"] = "301 Moved Permanently"
Comments are closed.