Flexible Friendly URLs for Farcry with Mod rewrite (Updated)

I've discovered a problem in the regex that I put in the previous blog I wrote about using mod rewrite for friendly urls.

It's nothing terminal and can very easily be fixed and would probably have been spotted by someone better at regex's than me :-)

The line:

RewriteRule .*/go([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&$2 [PT,L,QSA]
Should have been:
RewriteRule ^/go([^\?]*)(?:\?(.*))? /go.cfm\?path=/go$1&$2 [PT,L,QSA]

This forces the regex to match the url from the start - otherwise the following url would match at the second /go and wouldn't work.

With the old rule rewrite this as follows:

While the new rule does what we want at rewrites it as this:

I've updated the original article to use the correct regular expression.

Update - another fix to the regex - see related article

Comments
Where can you download the fryCry FU code?
The link on the fryCry site does not work.
# Posted By JEDI | 7/13/07 4:44 AM
@JEDI

I've had a look and unfortunately it looks like spikes site where it used to live is mostly derelict now and the cfopen.org site that my original post linked to is either down or no longer used.

I'd suggest using a mod rewrite or similar functionality for IIS if that's what you are using. The technique is simpler to manage and more flexible. There is some discussion of the IIS options in the comments of my original post: http://www.lynchconsulting.com.au/blog/index.cfm/2...

Cheers,
Mark
# Posted By Mark Lynch | 7/13/07 6:47 AM
BTW if you do find a link to Spikes FU Code please post it here for others.
Cheers,
Mark
# Posted By Mark Lynch | 7/13/07 7:08 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.