<?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>Thomas Gabrielsens weblog &#187; rewrite engine</title>
	<atom:link href="http://arton.no/tag/rewrite-engine/feed/" rel="self" type="application/rss+xml" />
	<link>http://arton.no</link>
	<description>Just another weblog</description>
	<lastBuildDate>Sun, 05 Feb 2012 11:29:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Flash and SEO</title>
		<link>http://arton.no/2008/05/12/flash-and-seo/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flash-and-seo</link>
		<comments>http://arton.no/2008/05/12/flash-and-seo/#comments</comments>
		<pubDate>Mon, 12 May 2008 19:28:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[amfphp]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[rewrite engine]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://arton.no/blog/?p=10</guid>
		<description><![CDATA[Flash and SEO has been quite a problem and the main argument for the people in the business who is against Flash. I&#8217;ve planned to do something about this for a long time and finally I found a project that was suitable to try this. First I will say that many people think that making [...]]]></description>
			<content:encoded><![CDATA[<p>Flash and SEO has been quite a problem and the main argument for the people in the business who is against Flash. I&#8217;ve planned to do something about this for a long time and finally I found a project that was suitable to try this. First I will say that many people think that making a website completely in Flash is craziness, and very often I do agree. However sometimes the client wants a &#8220;flashy&#8221; site with lots of animations and stuff and how am I to deny them that?</p>
<p>Since the introduction of <a href="http://blog.deconcept.com/swfobject/" target="_blank">SWFObject</a> it&#8217;s been quite easy to provide the user with html content for those who does not have flash installed, and this is what I&#8217;ve done. Since I use <a href="http://www.amfphp.org/">amfphp</a> a lot and also for my little CMS for flash, all the content except from the images are stored in a mySQL database. This makes it easy to extract all the content and echo it out in the flashcontent div tag.</p>
<p>I did this for a project called <a href="http://www.moelo.no" target="_blank">moelo.no</a> and after a while Google <a href="http://www.google.no/search?q=site%3Amoelo.no&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a">index the whole site</a>. To make it even more search friendly I used <a href="http://www.apache.org/">Apache</a> <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html">Rewrite Engine</a> to replace the query string URL with more search friendly URLs. I was surprised how easy easy it was to write the rewrite rule. Here is the all the lines I had to write to make it work:<br />
<code><br />
</code></p>
<p>RewriteRule ^kategori/([0-9]+)/underkategori/([0-9]+)/prosjekt/ ([0-9]+)(.*)\.html$ index.php?KategoriID=$1&amp;UnderkategoriID=$2&amp;ProsjektID=$3<br />
RewriteRule ^kategori/([0-9]+)/underkategori/([0-9]+)(.*)\.html$ index.php?KategoriID=$1&amp;UnderkategoriID=$2<br />
RewriteRule ^kategori/([0-9]+)(.*)\.html$ index.php?KategoriID=$1</p>
<p>Now basically what this does is rewrite a url that looks like this:</p>
<p><a href="http://www.moelo.no/index.php?KategoriID=1&amp;UnderkategoriID=6" target="_blank">http://www.moelo.no/index.php?KategoriID=1&amp;UnderkategoriID=6</a></p>
<p>to this:</p>
<p><a href="http://www.moelo.no/kategori/1/underkategori/6/" target="_blank">http://www.moelo.no/kategori/1/underkategori/6/</a></p>
<p>Then I add a suffix that takes the title of the article as filename and adds a .html extension to the end to to the URL to make it even more search friendly. The rewrite engine rules just ignores this.  Now the URL looks like this:</p>
<p><a href="http://www.moelo.no/kategori/1/underkategori/6/boliger.html" target="_blank">http://www.moelo.no/kategori/1/underkategori/6/boliger.html</a></p>
<p>The next trick was to actually show the right content in the flash version as well when a user clicked a link in Google. I did this very easy by passing the arguments to SWFObject and this way I could load them as variables in flash:</p>
<p><code><br />
var so = new SWFObject("<a href="http://www.moelo.no/index.swf" class="linkification-ext" title="Linkification: http://www.moelo.no/index.swf">http://www.moelo.no/index.swf</a>", "index", "1000", "600", "8", "#ffffff");<br />
so.addParam("quality", "best");<br />
so.addVariable("kategoriid", "4");<br />
so.addVariable("underkategoriid", "15");<br />
so.addVariable("prosjektid", "122");<br />
so.addVariable("forsiden", "");<br />
so.write("wrapper");</code></p>
<p>Finally I added a rule in the robot.txt file that blocks the SWF-file from all robots.</p>
<p>It works like a charm!</p>
<p>The next job is to rewrite my hole flash based CMS into OOP because the hole shit is written in procedural code. This happened because it started as a minor project a long time ago and it has escalated for each project, and this makes it a pain in the ass to update and maintain.</p>
]]></content:encoded>
			<wfw:commentRss>http://arton.no/2008/05/12/flash-and-seo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

