<?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>Fri, 30 Sep 2011 23:21:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</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>]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

