Most active topics
Social bookmarking
Bookmark and share the address of warez forum on your social bookmarking website
Bookmark and share the address of SEO Forum on your social bookmarking website
How to setup a 301 Redirect
SEO Forum :: BlackHatWorld :: SEO
Page 1 of 1
How to setup a 301 Redirect
How to setup a 301 RedirectThe “301 Permanent
Redirect” is the most efficient and search engine friendly method for
redirecting websites. You can use it in several situations, including:
- to redirect an old website to a new address
- to setup several domains pointing to one website
- to enforce only one version of your website (www. or no-www)
- to harmonize a URL structure change
There are several ways to setup a 301 Redirect, below I will cover the most used ones:
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.
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/page.html");
exit();
?>
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.
<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST']
.$_SERVER['REQUEST_URI']);
}
?>
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"
Response.AddHeader='Location','http://www.new-url.com/'
%>
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
%>
SEO Forum :: BlackHatWorld :: SEO
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Fri Nov 02, 2012 8:13 am by krishdell
» Buy PVA Hotmail Accounts
Tue Oct 23, 2012 7:00 am by kristendesouza
» Buy Twitter Followers | Buy Bulk Twitter Followers
Sat Oct 06, 2012 3:15 am by doofymartin
» Buy Twitter Followers | Buy Bulk Twitter Followers
Sat Oct 06, 2012 3:11 am by doofymartin
» Buy Twitter Followers | Buy Bulk Twitter Followers
Sat Oct 06, 2012 3:06 am by doofymartin
» High Pr [03-09] Back Link list and do follow website's
Sat May 07, 2011 9:11 am by Admin
» [GET] FUll Free Pakage 7000+ Backlinks - BACKLINKBonanza! d0f0llow Forum Links, Blog Comments and more!
Mon May 02, 2011 6:21 am by bdconnect
» 100$/Day....1000%working Trick (only 15min/day working)
Sun Apr 24, 2011 12:08 am by Admin
» Invest 1$ and trick to increase it
Sun Apr 10, 2011 9:49 am by Admin
» 10 Steps to Buying Anything Online for $.01 by Hacking Paypal
Thu Mar 10, 2011 9:14 am by virus231
» Hacking Rapid share and mega upload
Thu Mar 10, 2011 9:11 am by virus231
» Top 11 URl Shortening services - Learn alatest Computer And Mobile Hacking Tricks
Thu Mar 10, 2011 6:26 am by virus231
» SEOmoz Guides SEO Books
Thu Mar 10, 2011 6:21 am by virus231
» Advanced Bulk Backlinks Checker
Thu Mar 10, 2011 6:19 am by virus231
» Super Hide IP 3.0.9.2 + Patch
Mon Feb 28, 2011 4:02 am by samflynn
» Scientific Toolworks Understand 2.6.554 x86/x64 + Keygen
Mon Feb 28, 2011 3:53 am by samflynn
» Joboshare DVD Copy v2.9.9.0219 + Keygen
Mon Feb 28, 2011 3:30 am by samflynn
» FlashFXP 4.0.0 Build 1539 + Patch
Mon Feb 28, 2011 3:20 am by samflynn
» Efofex FX Equation v4.004.5 + Keygen
Mon Feb 28, 2011 3:10 am by samflynn
» AceMoney 4.15.1 + Keynaker
Mon Feb 28, 2011 3:00 am by samflynn