<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>Lynch Consulting Blog - Farcry</title>
			<link>http://www.lynchconsulting.com.au/blog/index.cfm</link>
			<description>A blog about ColdFusion, PHP, Flash, Flex, Web Standards and a mish mash of other technologies</description>
			<language>en-us</language>
			<pubDate>Tue, 07 Sep 2010 12:59:00 --1000</pubDate>
			<lastBuildDate>Tue, 13 Mar 2007 09:26:00 --1000</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>mark@lynchconsulting.com.au</managingEditor>
			<webMaster>mark@lynchconsulting.com.au</webMaster>
			
			
			
			
			
			<item>
				<title>Easy cross platform and environment file paths</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2007/3/13/Easy-cross-platform-and-environment-file-paths</link>
				<description>
				
				One of the very useful and underrated functions in ColdFusion is the humble ExpandPath function.  It has saved my life on many occasion and I just thought I&apos;d explain how it works and what it does.

If you or dealing with file or directory manipulation on from CF then you will often need a way to get a file system path.  You could just use it as follows:
&lt;code&gt;
&lt;cfdirectory action=&quot;list&quot; name=&quot;dirList&quot; directory=&quot;c:\farcry\myApp&quot;&gt;
&lt;/code&gt;

This is of course very nasty as when you put this onto your live server you may not have farcry installed in c:\ - it may be somewhere completely different (particularly on shared hosting).  Alternatively your live server may be a linux box in which case there is no &quot;C:&quot; drive at all.

To solve this and make you applications nice an portable you can use expandPath on a cf mapping.  So assuming you have a cf mapping for /farcry to c:/farcry you would use the following:

&lt;code&gt;
&lt;cfdirectory action=&quot;list&quot; name=&quot;dirList&quot; directory=&quot;#expandPath(&apos;/farcry&apos;)#/myApp&quot;&gt;
&lt;/code&gt;

This will now happily run on any machine that has the farcry mapping and will map to whatever location the mapping points to.

Cheers,
Mark
				
				</description>
				
				<category>ColdFusion</category>
				
				<category>Farcry</category>
				
				<pubDate>Tue, 13 Mar 2007 09:26:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2007/3/13/Easy-cross-platform-and-environment-file-paths</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flexible Friendly URLs for Farcry with Mod rewrite (Updated)</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2007/1/23/Flexible-Friendly-URLs-for-Farcry-with-Mod-rewrite-Updated</link>
				<description>
				
				I&apos;ve discovered a problem in the regex that I put in the previous blog I wrote about using mod rewrite for friendly urls.

It&apos;s nothing terminal and can very easily be fixed and would probably have been spotted by someone better at regex&apos;s than me :-)

The line:
&lt;code&gt;
RewriteRule .*/go([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&amp;$2 [PT,L,QSA]
&lt;/code&gt;
Should have been:
&lt;code&gt;
RewriteRule ^/go([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&amp;$2 [PT,L,QSA]
&lt;/code&gt;

This forces the regex to match the url from the start - otherwise the following url would match at the second /go and wouldn&apos;t work.

&lt;code&gt;
http://www.example.com/go/articles/good_title_for_a_topic
&lt;/code&gt;

With the old rule rewrite this as follows:
&lt;code&gt;
http://www.example.com/go.cfm?path=/good_title_for_a_topic
&lt;/code&gt;

While the new rule does what we want at rewrites it as this:
&lt;code&gt;
http://www.example.com/go.cfm?path=/go/articles/good_title_for_a_topic
&lt;/code&gt;

I&apos;ve updated the &lt;a href=&quot;http://www.lynchconsulting.com.au/blog/index.cfm/2007/1/7/Flexible-Friendly-URLs-for-Farcry-with-Mod-rewrite&quot;&gt;original article&lt;/a&gt; to use the correct regular expression.

Update - another fix to the regex - see related article
				
				</description>
				
				<category>Systems admin</category>
				
				<category>Farcry</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Tue, 23 Jan 2007 00:00:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2007/1/23/Flexible-Friendly-URLs-for-Farcry-with-Mod-rewrite-Updated</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Flexible Friendly URLs for Farcry with Mod rewrite</title>
				<link>http://www.lynchconsulting.com.au/blog/index.cfm/2007/1/8/Flexible-Friendly-URLs-for-Farcry-with-Mod-rewrite</link>
				<description>
				
				I&apos;ve known about and used &lt;a href=&quot;http://cfopen.org/projects/fuservlet&quot;&gt;Spike&apos;s friendly URL servlet&lt;/a&gt; which does a great job of handling friendly URLs for quite a while, but recently I was shown an alternative way by &lt;a href=&quot;http://www.websonic.ie&quot;&gt;Gav Cooney of Websonic&lt;/a&gt;.

This alternative method uses &lt;a href=&quot;http://httpd.apache.org/docs/2.0/misc/rewriteguide.html&quot;&gt;apache&apos;s mod_rewrite functionality&lt;/a&gt; to dynamically rewrite the url before passing it to ColdFusion.  This example uses the exact same format as the FU servlet so it should be possible to drop it into place.

So without further ado - here is what you do.

Put this in the virtual host section of your apache config:
&lt;code&gt;
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteRule ^/go([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&amp;$2 [PT,L,QSA]
&lt;/code&gt;

&lt;h3&gt;Advantages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Simple to change the prefix: i.e. /go/ or use multiple different ones&lt;/li&gt;
&lt;li&gt;Can add additional parameters&lt;/li&gt;
&lt;li&gt;Moves the load from java to apache, which is easier to scale&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Disadvantages&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Not available on IIS - which isn&apos;t really a disadvantage :-)&lt;/li&gt;
&lt;/ul&gt;

Here&apos;s and example of some of the flexibility:
Multiple working urls which pass a parameter - /ie/ add language=ie and /en/ adds language=en
&lt;code&gt;
RewriteRule ^/en([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&amp;$2&amp;language=en [PT,L,QSA]
RewriteRule ^/ie([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&amp;$2&amp;language=ie [PT,L,QSA]
&lt;/code&gt;

Hope it helps, and love to hear your thoughts or comments.

Updated - changed regex to always use the start of the url - see related article.

Update 2 - another fix to the regex - see related article
				
				</description>
				
				<category>Ubuntu</category>
				
				<category>Open Source</category>
				
				<category>Linux</category>
				
				<category>Farcry</category>
				
				<category>ColdFusion</category>
				
				<pubDate>Mon, 08 Jan 2007 05:06:00 --1000</pubDate>
				<guid>http://www.lynchconsulting.com.au/blog/index.cfm/2007/1/8/Flexible-Friendly-URLs-for-Farcry-with-Mod-rewrite</guid>
				
			</item>
			
		 	
			</channel></rss>