Do you want to have your website automatically redirect to another site or specific page? (read on)
Redirects are fairly simple. BUT you need to know what type of file types you are using (php, asp, cfm, etc.) OR if your webhost uses to “cPanel” you can this without knowing code.(watch quick video) One important note to consider when doing this is to not only think about the redirect but how the search engines will treat the redirect. Most folks want to get (and keep) the best search results they can and implementing redirects can affect those search results. Google and the others look very carefully at redirects to make sure that their results point to valid content. How do implement correctly? “301 Redirects” (The 301 tells search engines that the page has *permanently* moved to a new location and keeps your search engine results in tact) There are other redirect types, but for this post, we’ll just deal with 301s.
So What Exactly Do I Need to Do To Correctly Redirect My Site??
Below are snippets of code (by script/file type) to place at the very top of your homepage: (These snippets are for those who are not using content management systems like WordPress. Most likely you’ll need to implement the redirect via .htaccess, either manually or via cPanel)
header( “HTTP/1.1 301 Moved Permanently” );
header( “location: http://www.thenewsite.com” );
private void Page_Load(object sender, System.EventArgs e)
Response.Status = “301 Moved Permanently”;
Ruby on Rails Redirect
headers[“Status”] = “301 Moved Permanently”
<%@ Language=VBScript %>
Response.Status=”301 Moved Permanently”
response.setHeader( “Location”, “http://www.thenewsite.com” );
response.setHeader( “Connection”, “close” );
PERL / CGI Redirect
$q = new CGI;
You can also do an .htaccess redirect (copy and paste the code below into a new file as save as “.htaccess”) This single file, uploaded to the root directory of your website will redirect all directories and page files from your existing domain to the new domain.
RewriteRule (.*) http://www.thenewsite.com/$1 [R=301,L]
Replace the “www.thenewsite.com” in the above code with your actual domain name.
This works ONLY on Linux servers with the Apache Mod-Rewrite moduled enabled. (talk to your webhost to verify)
*If for whatever reason (as a last resort) you can only redirect a flat html page, please do the folowing “Meta Refresh” (I mention this because Google doesn’t really like it) ;)
<meta http-equiv=”refresh” content=”0;URL=http://whatever.com”>
Create Redirects via Cpanel
(video courtesy of LearningCPanel)