The 5.1 version of the framework got a big 'ol kick in the pants (especially for a point release) with the entire friendly URL engine undergoing a rewrite (hah). I upgraded one my works in progress for Meteorsite from the 5.02 to 5.1 recently and noticed that my older friendly URLs were no longer being built by the buildlink tag, but they still worked when called with the older /go/ syntax. Hmm... time to investigate.
It turns out, you no longer need to prefix the friendly URL with a search term any longer. No more /go/ or /this/ or /something/ is required. Now, mysite.com/lets-start-this-party will work. Hey, I think it's cool at least, and the VP of marketing at my last job would have loved not having to prefix everything with a /go/.
The magic behind all of this some rather nifty REGEX string to manipulate the URL, and a new piece in the framework that verifies that friendly URLs are working (which broke my current FUs). Once you manage to pass the FU check (http://yoursite.com/pingFU returns a success), your FUs will work as desired. The REGEX and setup instructions can be found on the FarCry WIKI.
Everything was all good until... well, we're on windows, and not running Apache or the the Helicon rewrite filter. Instead, we're running the Ionic filter, and it seems the rewrite rule just doesn't work all that well based on what's in the docs. So began my quest to make that #@$#$ rewrite rule work for the Ionic filter. So, let's first run through how to install the Ionic filter.
Installing the Ionic filter
-
If you just want to test with a single website, grab the IONIC 1.2.15. If you want to use this on multiple sites on the same machine, grab 2.0a. It really doesn't matter as the script works on
both.
-
Inside the zip, you'll find a lib folder. The two different code branches have diffrerent DLLs names and INI names.
-
1.2.15: Doesn't matter where you put it, just not in the
webroot. Put the IsapiRewrite4.dll and IsapiRewrite4.ini file in a separate folder (good to only have them in there by themselves).
-
2.0a: Again, put it where you want, but not in the
webroot (for 2 of 3 files). Put the IirfGlobal.ini and Iirf.dll in the same folder. Place a Iirf.ini in your webroot.
-
The script I send should be used in either case for either
Iirf.ini, or IsapiRewrite4.ini. Don't touch the IirfGlobal.ini, it only takes the options already in the file.
-
Windows permissions seem to be the biggest gotcha here. The files all seem to need, at minimum, IIS_WPG and IUSER_. Mine also have Users, SYSTEM, and Administrators if it just the first two don't work for you.
-
Open up the IIS Admin tool.
-
Click on web service extensions, and add a new extension for "Ionic Rewriter" (doesn't matter, but I think you need to be consistant here) and choose the appropriate DLL (depending on 1.2.15, 2.0a). Be sure to check the box to set for allowed.
-
Depending on the level you want to filter at (all sites, just one site) right click and get properties. Click on the ISAPI Filters tab and add the appropriate DLL and click apply or OK (doesn't matter).
-
Restart the IIS admin (should restart all of the various
services too).
My current rewrite script - constantly evolving
# Firstly, let's make sure that the URL is not an admin
# function. The "!" does not work here
# So it was removed. Added [L] to stop processing other
# rules for recursion issues. If you have .xxx files that
# take a URL param, add it here
RewriteCond %{HTTP_URL} (^/farcry|^/webtop|^/flex2gateway|^/flashserviReces|^/cfide|\.cfm|\.swf|\.xml)($|/)
RewriteRule ^(.*)$ $1 [L]
# Next, if it doesn't match the above, let's to see if
# there's a "?" in the string and rewrite it to be
# a "&". This is to catch cases like
# /something/?this=here. We stop processing here to
# prevent going all circular in our logic by using the "[L]".
RewriteCond %{HTTP_URL} (.*)(\?)(.*)
RewriteRule (.*)(\?)(.*) /index.cfm?furl=$1&$3 [L]
# This was junked as the first rule replaced it, but
# leaving it here just in case commented out
#RewriteCond %{HTTP_URL} (^\.index.cfm)
#RewriteRule ^(.*)$ $1
# Last, failing all else, rewrite the string to the
# normal furl sequence. Removed the checking
# for a space from the WIKI sequence as it breaks for IONIC.
RewriteRule ^([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?\,\*\!\@\#\$\(\)\^_`~]*)$ /index.cfm?furl=$1
Be sure to follow all of the directions in that WIKI entry, in addition to what I've provided here. At this point, it works for everything that I've thrown at it. Going to /cfide, or /farcry works. Going to the normal .cfm files works, and my flash players all work. I've run into the odd issue where I've tried to reference the application.url.conjurer URL, but I've since switched to buildlink to replace calls to that variable. The other odd issue is that the first condition was having case sensitivity issues.
The application stores a list of URLs that match a page objectid. If found to have a match, it supplies the objectid after furl=. The browser is really none the wiser, since all it ever sees is the friendly URL.