SEO Israel - Professional SEO Services

SEO & Digital Marketing

 
 

Permanent Redirect

 
SEO Israel » Website Hosting » Permanent Redirect

Additional Articles:
Website Hosting
Class C
Permanent Redirect
Permanent Redirect - 301
Why is it Important to have a Permanent Redirect?
Testing the HTTP Header
Redirect at Server Level vs. Redirect at Site Level
Permanent Redirect through the Server
Order of Commands is Important
Permanent Redirect on IIS
Permanent Redirect with ASP
Permanent Redirect with PHP

A permanent redirect allows you to inform your visitors or search engines that reach your website that a certain page, folder or the entire site moved to a new address. The redirection to the new address will be automatic for site users, while the address displayed in the address bar on their browser will be updated to new URL.

When you request a page in the regular manner, the server returns to the user a 200 code that states that the request was successful. In case of a permanent redirect, the server returns a 301 code and the updated URL of the requested resource.

Permanent redirect is designed to perform the following actions:

Switching domains: www.domain.com -> www.domain.co.il
Redirecting a part of the website to a new domain (e.g.: splitting a website in two)
Redirecting a folder on your site to a new folder
Redirecting a page on your site to a new address

The abovementioned changes require access to the site's .htaccess files. In the event the website no longer exists, or will not exist in the future, you should ask your service provider to perform the redirection at server level (through the httpd.conf file).

Why is it Important to have a Permanent Redirect?

In many cases site owners wish to change their website's structure, or its domain. These kind of changes may create several problems:

Duplicate Content: A new domain may be scanned by search engine robots that will define it as a copy of the old site, and thus disqualify it.

Dead Links: Links to the old site that you created with great effort will reach an error message.

Returning Visitors: Users that added your site to their Favorites list will reach the old URL.

Testing the HTTP Header

After performing a permanent redirect, you should make sure that the redirect indeed functions properly, and that you receive a 301 code when you reach the old page or domain, and not a different code (e.g.: code 302).

HTTP Header Website or Webpage Testing Tool:
HTTP status code checker

Redirect at Server Level vs. Redirect at Site Level

You can perform the permanent redirect at server level (through your hosting services provider) or at site level.

Advantages and disadvantages of server level redirection (httpd.conf):

Advantage: the change will still be available even when the website no longer exists
Advantage: this change is most effective as of server load level
Disadvantage: any server level change requires restarting the server

Advantages and disadvantages of site level redirection (htaccess):

Advantage: higher flexibility - good for trial and error
Advantage: the site owner has control over the redirection without interference of the hosting service
Disadvantage: requires keeping the site on the server (or the folder in the least).

Permanent Redirect through the Server

First, the server should enable performing permanent redirections. This is done through the server's definitions file (httpd.conf), where you should define the next line:

AllowOverride All

Then, you can see a number of examples for writing permanent redirections by inserting commands to the htaccess file which you should place in the folder that contains the page that is about to change.

The general structure of the command is quite simple:

Redirect status old new

Here is the first example: using the htaccess file to redirecte a folder on the old site to a new domain (splitting a folder to a new website):

Redirect permanent /folder http://www.newdomain.com/newfolder

Any redirect that will reach the "folder" folder on the old site will be redirected to the "newfolder" folder under "newdomain.com" domain. The redirect will be to the new folder, and inside it to the page name. In case you also changed the names of the pages inside the folder, some problems may occur.

Here is an example of redirecting a single file to a different file (in this case - the new file is located on a different domain):

Redirect permanent /old.htm http://www.new.com/newpage.html

To conclude, a full redirect of a domain to a new domain:

Redirect permanent / http://www.newdomain.com/

Order of Commands is Important

Order of commands is important. The correct way to write the commands will be:

Redirect permanent /folder http://www.firstdomain.com/
Redirect permanent / http://www.seconddomain.com/

And not:

Redirect permanent / http://www.seconddomain.com/
Redirect permanent /folder http://www.firstdomain.com/

In the last example, the system will not reach the second condition.

Permanent Redirect on IIS

A permanent redirect on IIS requires access to the hosting server definitions. In order to perform the permanent redirect on IIS, you should perform the following:

Go to Internet Services Manager
Right-Click your mouse over the file or the folder that you wish to change
Choose the " a redirection to a URL" option
Type in the URL of the redirection target page
Choose "The exact URL entered above"
Choose " A permanent redirection for this resource"
Click Apply

Permanent Redirect with ASP

There is an option of performing a permanent redirect with an ASP command. Following is an example for a redirect code:

if lcase(request.servervariables("HTTP_HOST")) = "domain.com" then
   Response.Status="301 Moved Permanently"
   Response.AddHeader "Location", "http://www.domain.co.il/"
end if

This code checks whether the domain that originated the call is "domain.com", and in case it is, a permanent redirection is performed to "domain.co.il". The redirection should be performed before any input to the page, meaning before the html and head tags.

Permanent Redirect with PHP

There is an option of performing a permanent redirect with a PHP command. Following is an example for a redirect code:

<?php
   header("HTTP/1.1 301 Moved Permanently");
   header("Location: http://www.domain.co.il/");
?>

This code performs a permanent redirect to domain.co.il. The redirection should be performed before any input to the page, meaning before the html and head tags.

A customer that couldn't find you is your competitor's customer..

Please fill in your site's details so that we can contact you as soon as possible and answer your questions:


SEO Israel, 1'st Hamada St., Rehovot 76703, Israel. (+972)-73-2240000
Site:
Email:
Phone:
Name:
Contact SEO Israel
Name:
Site:
E-mail:
Phone:
Phone:972-73-2240000
Fax:972-73-2240022
Info Center

Our Company:

About SEO Israel
SEO/SEM Jobs in Israel
Our Clients
Contact Us

Services:

Optimization Techniques
Link Development
Internet Marketing
Google Adsense
Web Analytics
Google AdWords

Search Engines Info:

Search Engines
Google

Setting Up a New Site:

Website Hosting
Domain Name Registration

Additional Resources:

SEO Blog (Hebrew)
הסמכת גוגל AdWords הסמכת גוגל אנליטיקס
Site Map, Hebrew Site Valig XHTML 1.0
SEO Israel Facebook Page SEO Israel on LinkedIn Follow SEO Israel on Twitter SEO Israel on Google+