<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Rewriting URLs</title>
	<atom:link href="http://aaronmentele.com/2007/10/01/rewriting-urls/feed/" rel="self" type="application/rss+xml" />
	<link>http://aaronmentele.com/2007/10/01/rewriting-urls/</link>
	<description>personal blog of Aaron Mentele, web developer and partner at Electric Pulp</description>
	<lastBuildDate>Sun, 22 Jan 2012 21:00:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Nicholas Schlueter</title>
		<link>http://aaronmentele.com/2007/10/01/rewriting-urls/comment-page-1/#comment-22368</link>
		<dc:creator>Nicholas Schlueter</dc:creator>
		<pubDate>Tue, 02 Oct 2007 13:01:51 +0000</pubDate>
		<guid isPermaLink="false">http://charisma18.com/2007/10/01/rewriting-urls/#comment-22368</guid>
		<description>I like how you ignored rails, which is good because my point had nothing to do with rails or PHP.

I agree that planning your url structure up front is the best way to go.  But SEO has changed a lot recently, and you can&#039;t know the future.  If it turns out that search engines like the word &quot;in&quot;, in urls you would have to change it in multiple places first in your rewrite rule and all your links.  What you have now effectively is:

/products/:cat/:item

and if you needed to add &quot;in&quot;, it would look like:

/products/in/:cat/:item

Obviously this example is contrived, and I know this isn&#039;t specifically a technical blog, so I shouldn&#039;t belabor this point any longer.  But the brittleness I was speaking of actually has a term in Computer Science.  It is called coupling [http://en.wikipedia.org/wiki/Coupling_(computer_science)] and the way you are trying to accomplish SEO, I would classify as being tightly coupled.

It&#039;s all about managing the cost to change curve, oh my god I am boring myself, have a good time in SF.  Keep up the good work.</description>
		<content:encoded><![CDATA[<p>I like how you ignored rails, which is good because my point had nothing to do with rails or PHP.</p>
<p>I agree that planning your url structure up front is the best way to go.  But SEO has changed a lot recently, and you can&#8217;t know the future.  If it turns out that search engines like the word &#8220;in&#8221;, in urls you would have to change it in multiple places first in your rewrite rule and all your links.  What you have now effectively is:</p>
<p>/products/:cat/:item</p>
<p>and if you needed to add &#8220;in&#8221;, it would look like:</p>
<p>/products/in/:cat/:item</p>
<p>Obviously this example is contrived, and I know this isn&#8217;t specifically a technical blog, so I shouldn&#8217;t belabor this point any longer.  But the brittleness I was speaking of actually has a term in Computer Science.  It is called coupling [http://en.wikipedia.org/wiki/Coupling_(computer_science)] and the way you are trying to accomplish SEO, I would classify as being tightly coupled.</p>
<p>It&#8217;s all about managing the cost to change curve, oh my god I am boring myself, have a good time in SF.  Keep up the good work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Mentele</title>
		<link>http://aaronmentele.com/2007/10/01/rewriting-urls/comment-page-1/#comment-22329</link>
		<dc:creator>Aaron Mentele</dc:creator>
		<pubDate>Tue, 02 Oct 2007 02:47:13 +0000</pubDate>
		<guid isPermaLink="false">http://charisma18.com/2007/10/01/rewriting-urls/#comment-22329</guid>
		<description>Hey Nicholas.  You caught a screw up. I switched to a multi-variable example after the first draft - cut wrong.  I&#039;ve updated the post - thanks.

Rewrite rules don&#039;t cause brittle code, though.  People do. (That&#039;s a bumper sticker, right?)

Sure, changing your link convention will make your queries go to hell.  But that&#039;s no different than changing your query string.

The trouble comes in cases where the rules weren&#039;t considered as part of the initial dev / planning.  Backing into pretty URLs is a lot more difficult than factoring them in from the start.  I have examples.

See how I ignored the rails part?</description>
		<content:encoded><![CDATA[<p>Hey Nicholas.  You caught a screw up. I switched to a multi-variable example after the first draft &#8211; cut wrong.  I&#8217;ve updated the post &#8211; thanks.</p>
<p>Rewrite rules don&#8217;t cause brittle code, though.  People do. (That&#8217;s a bumper sticker, right?)</p>
<p>Sure, changing your link convention will make your queries go to hell.  But that&#8217;s no different than changing your query string.</p>
<p>The trouble comes in cases where the rules weren&#8217;t considered as part of the initial dev / planning.  Backing into pretty URLs is a lot more difficult than factoring them in from the start.  I have examples.</p>
<p>See how I ignored the rails part?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicholas Schlueter</title>
		<link>http://aaronmentele.com/2007/10/01/rewriting-urls/comment-page-1/#comment-22325</link>
		<dc:creator>Nicholas Schlueter</dc:creator>
		<pubDate>Tue, 02 Oct 2007 01:49:39 +0000</pubDate>
		<guid isPermaLink="false">http://charisma18.com/2007/10/01/rewriting-urls/#comment-22325</guid>
		<description>That is a crazy url.  I&#039;ll freely admit that I don&#039;t know PHP, and that I don&#039;t know what you got knocked for.  But, being a pretty fluent developer, and having cut &lt;strike&gt;a few&lt;/strike&gt; enough corners in my day, I can see where this would come in handy.  I have just never seen a question mark in the middle of a &quot;normal&quot; query string like that.

But, the trouble with mod_rewrite is that your code needs to know about that rewrite rule.  For example, you need to construct your links so that they will match the rewrite rule when the user clicks on them.  This is a little brittle, probably not a problem with smaller sites, but could be a problem with huge sites.  The only way around, that I have seen, is in rails (and therefore clones of rails).  It is called routes.  It &quot;routes&quot; requests to the proper controller and action, big deal.  But it also comes with link/url helpers that construct links that match the route.  That way if you decide your link structure is no good, when you change the route, all your links change with it.  It is a little magical but once you get the hang of it, you are no longer stuck in mod_rewrite (do I include the trailing slash) hell.

The good thing about mod_rewrite is it isn&#039;t language/framework dependent.  It is a tool I would not remove from my tool belt any time soon.</description>
		<content:encoded><![CDATA[<p>That is a crazy url.  I&#8217;ll freely admit that I don&#8217;t know PHP, and that I don&#8217;t know what you got knocked for.  But, being a pretty fluent developer, and having cut <strike>a few</strike> enough corners in my day, I can see where this would come in handy.  I have just never seen a question mark in the middle of a &#8220;normal&#8221; query string like that.</p>
<p>But, the trouble with mod_rewrite is that your code needs to know about that rewrite rule.  For example, you need to construct your links so that they will match the rewrite rule when the user clicks on them.  This is a little brittle, probably not a problem with smaller sites, but could be a problem with huge sites.  The only way around, that I have seen, is in rails (and therefore clones of rails).  It is called routes.  It &#8220;routes&#8221; requests to the proper controller and action, big deal.  But it also comes with link/url helpers that construct links that match the route.  That way if you decide your link structure is no good, when you change the route, all your links change with it.  It is a little magical but once you get the hang of it, you are no longer stuck in mod_rewrite (do I include the trailing slash) hell.</p>
<p>The good thing about mod_rewrite is it isn&#8217;t language/framework dependent.  It is a tool I would not remove from my tool belt any time soon.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

