<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Smullin &#187; SEO</title>
	<atom:link href="http://www.mikesmullin.com/tag/seo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikesmullin.com</link>
	<description>Personal Blog</description>
	<lastBuildDate>Sat, 31 Jul 2010 00:06:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Use Categories in Product URLs for Magento SEO without Duplicate Content</title>
		<link>http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/</link>
		<comments>http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 03:51:07 +0000</pubDate>
		<dc:creator>Mike Smullin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Patch]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.mikesmullin.com/?p=319</guid>
		<description><![CDATA[Magento provides the option to use categories in your product URLs for the search engine optimization benefits it brings, but they&#8217;ve implemented it in a very unusual way. Basically, if you enable this option, you&#8217;ll end up with at least 4 URLs per product. Once people realize it, this often raises a number of concerns]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/magento1.png" alt="Magento Open Source eCommerce logo" title="Magento Open Source eCommerce logo" width="150" height="150" class="alignright size-full wp-image-133" /> Magento provides the option to use categories in your product URLs for the search engine optimization benefits it brings, but they&#8217;ve implemented it in a very unusual way. Basically, if you enable this option, you&#8217;ll end up with at least 4 URLs per product. Once people realize it, this often raises a number of concerns including possible duplicate content penalty from Google, fractured link juice for product pages, frustrated admins, etc.</p>
<p>With <a href="http://www.magento.cn/104/magento-shopping-cart/magento-seo-friendly-urls/">so</a> <a href="http://www.magentocommerce.com/boards/viewthread/33562/">many</a> <a href="http://www.hostingcoupons.org/magento-use-category-path-for-product-url-issues/">people</a> <a href="http://www.virtueseo.com/seo-blog/2008/08/25/magento-seo-duplicate-content-threat/">also</a> <a href="http://www.magentocommerce.com/boards/viewforum/81/">searching</a> <a href="http://www.magentocommerce.com/boards/viewthread/3008/">for a clever</a> <a href="http://www.magentocommerce.com/boards/viewthread/6002/">solution</a>, I decided disabling the feature was an unacceptable solution, and took the challenge.</p>
<p><span id="more-319"></span></p>
<p>First you have to enable the <a href="http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/chapter_3#search_engine_optimizations">&#8220;Use categories path for product URLs&#8221;</a> feature under <strong>System</strong> > <strong>Configuration</strong> > <strong>Catalog</strong> > <strong>Search Engine Optimization</strong>.</p>
<blockquote><p>
Use categories path for product URLs &#8211; This determines how the <acronym title="Uniform Resource Locator">URL</acronym> Rewrites autogenerate. If you choose Yes, the <acronym title="Uniform Resource Locator">URL</acronym> rewrite for products will include the associated category, and a separate rewrite will generate for each associated category. If you choose No, the <acronym title="Uniform Resource Locator">URL</acronym> Rewrites will include only the product name, and there will be only one rewrite, regardless of how many categories the product is associated to.
</p></blockquote>
<p>Once this feature is enabled, you&#8217;ll be to use any of these URLs to visit the same product page:</p>
<ul>
<li>
<p><strong>/catalog/product/view/id/&lt;product_id&gt;</strong><br />
	    <small>example: http://www.domain.tld/catalog/product/view/id/6</small><br />
      Internal to Magento; never actually exposed.</p>
</li>
<li>
<p><strong>/catalog/product/view/id/&lt;product_id&gt;/category/&lt;category_id&gt;</strong><br />
	    <small>example: http://www.domain.tld/catalog/product/view/id/6/category/10</small><br />
      Internal to Magento; never actually exposed.</p>
</li>
<li>
<p><strong>/name-of-product</strong><br />
	    <small>example: http://www.domain.tld/super-dee-duper-tent-1000-olive</small><br />
      Normally used on the front page, in content blocks, or anywhere other than a category page. This is because without being on a category page, Magento doesn&#8217;t know which category would be appropriate to display in the <acronym title="Uniform Resource Locator">URL</acronym> (since it provides the ability to have multiple categories per product). Therefore it opts to not display any category at all. A bad decision in my opinion.</p>
</li>
<li>
<p><strong>/category-1/sub-category-1/name-of-product</strong><br />
	    <small>example: http://www.domain.tld/sporting-goods/camping-hiking/super-dee-duper-tent-1000-olive</small><br />
      Used from category pages.</p>
</li>
<li>
<p><strong>/category-2/name-of-product</strong><br />
	    <small>example: http://www.domain.tld/affordable-housing/super-dee-duper-tent-1000-olive</small><br />
      Used from category pages.</p>
</li>
<li>
<p><strong>etc.</strong><br />
      Depending on how many categories per product.</p>
</li>
</ul>
<p>Personally, I don&#8217;t like my products having multiple URLs. Between the front page and the category pages, two separate URLs are introduced to GoogleBot as it crawls through the pages. Even though <a href="http://www.magentocommerce.com/boards/viewthread/18538/">you may not be seriously penalized for duplicate content</a>, which page do you want to appear in Google SERPs? Which one do you want your customers to link at? You&#8217;re splitting your link juice and causing confusion.</p>
<p>When I saw this feature for the first time, all I really expected was a single <acronym title="Uniform Resource Locator">URL</acronym> like:</p>
<p><strong>http://www.domain.tld/sporting-goods/camping-hiking/super-dee-duper-tent-1000-olive</strong></p>
<p>Well, it took about four hours to find, but I finally came up with a patch to Magento core that delivers this result. Check it out below in unified diff / patch file format:</p>
<pre><code>
Index: app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php
===================================================================
--- app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php	(revision 2102)
+++ app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Collection.php	(working copy)
@@ -553,7 +553,11 @@
                 ->from($this->getTable('core/url_rewrite'), array('product_id', 'request_path'))
                 ->where('store_id=?', Mage::app()->getStore()->getId())
                 ->where('is_system=?', 1)
-                ->where('category_id=? OR category_id is NULL', $this->_urlRewriteCategory)
+//                excluding this clause to facilitate one URL per product, and one that includes the category
+//                if a product has multiple categories, the first one (by category_id) will be used
+//                in most cases you'll probably only have one category because you only want one page per product for SEO reasons
+//                for maximum link juice, no possibility of duplicate content, and a less confusing store
+//                ->where('category_id=? OR category_id is NULL', $this->_urlRewriteCategory)
                 ->where('product_id IN(?)', $productIds)
                 ->order('category_id DESC'); // more priority is data with category id
             $urlRewrites = array();
</code></pre>
<p>In my setup, each product only has one category. Although this will also work if you specify multiple categories per product, you won&#8217;t have complete control over which category is used for the official link.</p>

<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-caring-old">
<ul class="socials">
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;n=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content&amp;pli=1" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;title=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;title=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;t=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;title=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;title=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content&amp;summary=%20Magento%20provides%20the%20option%20to%20use%20categories%20in%20your%20product%20URLs%20for%20the%20search%20engine%20optimization%20benefits%20it%20brings%2C%20but%20they%27ve%20implemented%20it%20in%20a%20very%20unusual%20way.%20Basically%2C%20if%20you%20enable%20this%20option%2C%20you%27ll%20end%20up%20with%20at%20least%204%20URLs%20per%20product.%20Once%20people%20realize%20it%2C%20this%20often%20raises&amp;source=Mike Smullin" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;t=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;title=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/&amp;title=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content+-+http://b2l.me/dc26c&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-yahoomail">
			<a href="http://compose.mail.yahoo.com/?Subject=Use+Categories+in+Product+URLs+for+Magento+SEO+without+Duplicate+Content&amp;body=Link: http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A %20Magento%20provides%20the%20option%20to%20use%20categories%20in%20your%20product%20URLs%20for%20the%20search%20engine%20optimization%20benefits%20it%20brings%2C%20but%20they%27ve%20implemented%20it%20in%20a%20very%20unusual%20way.%20Basically%2C%20if%20you%20enable%20this%20option%2C%20you%27ll%20end%20up%20with%20at%20least%204%20URLs%20per%20product.%20Once%20people%20realize%20it%2C%20this%20often%20raises" rel="nofollow" class="external" title="Email this via Yahoo! Mail">Email this via Yahoo! Mail</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
