// // Create a fake order ID using the current // time and the unique identifier that GA uses to // track this visitor. // var timeObj = new Date; var unixTimeMs = timeObj.getTime(); var unixTime = parseInt(unixTimeMs / 1000); var orderID = pageTracker._visitCode() + '-' + unixTime; // // This function assigns order values depending // on what has been clicked and submits the transaction // function subscriptiontracker(subtype,value) { pageTracker._addTrans( orderID, // Order ID "", // Affiliation value, // Total "", // Tax "", // Shipping "", // City "", // State "" // Country ); pageTracker._addItem( orderID, // Order ID subtype, // SKU subtype, // Product Name "blog", // Category value, // Price "1" // Quantity ); pageTracker._trackTrans(); alert("Test successful"); }

Canonical domain 301 redirects

by Kevin Gibbons on March 14, 2006

During the re-design of this website I have ensured that a canonical form of domain listing is not indexed by redirecting kevingibbons.co.uk to www.kevingibbons.co.uk. This is important as a website can be penalised if it has duplicate content appearing in the SERPs. The best way of redirecting the canonical url is via a 301 redirect which lets the search engines know that the page has been permanently moved. This is generally setup via server settings such as .htaccess or an IIS redirect but as my hosting account does not allow this I have had to hardcode this into the site. I’ve added the code to redirect to the www subdomain below using .htaccess and both ASP and PHP.

ASP Subdomain Redirect Code:
<%
If Request.ServerVariables(”HTTP_HOST”) = “mysite.com” Then
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://www.mysite.com” & Request.ServerVariables(”PATH_INFO”)
End If
%>

PHP 301 Subdomain Redirect Code:
<?
if ( strtolower($_SERVER['HTTP_HOST']) == “mysite.com” )
{
header(”HTTP/1.1 301 Moved Permanently”);
header(”Location: http://www.mysite.com” . $_SERVER["REQUEST_URI"]);
exit();
}
?>

.htaccess Apache mod_rewrite 301 redirection:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.com [nc]
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]

If you need to redirect an individual URL using .htaccess you should use the following line of code:
Redirect 301 /filename http://www.domain.com

Microsoft IIS 6.0 301 redirects
Via Microsoft Support:

To redirect browser requests to another folder or Web site:
1. Start Internet Services Manager.

Alternatively, start the IIS Snap-in in Microsoft Management Console (MMC).
2. Click to expand * server name, where server name is the name of the server.
3. Right-click either the Web site or the folder that you want to redirect, and then click Properties.
4. Click one of the following tabs that is appropriate to your situation:
• Home Directory
• Virtual Directory
• Directory
5. Under When connecting to this resource, the content should come from, click A redirection to a URL.
6. Type the URL of the destination folder or Web site in the Redirect to box.

For example, to redirect all requests for files in the Products folder to the NewProducts folder, type /NewProducts. To redirect all requests for files located at www.mycompany.com/products to sales.mycompany.com/newproducts, type http://sales.mycompany.com/newproducts.
7. Click OK.

No related posts.

Struggling to make your online marketing sparkle?

SEOptimise SEO

If you liked this post, you'll love what we can do with your SEO, PPC and online marketing campaigns. You can have the authors of this blog work directly on your campaigns!

{ 2 trackbacks }

Changing domain name | SEOptimise
02.15.08 at 11:39 pm
78 Essential Search Engine Marketing & SEO Resources! | SEOptimise
07.08.08 at 10:29 am

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>