<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Blog of Shaun McCran - Architecting robust, elegant technical and business solutions - Isapi rewrite</title>
			<link>http://www.mccran.co.uk/index.cfm</link>
			<description>I write about Architecture and Design, Architectural patterns, Architectural Principles and Architectural policies. This includes TOGAF, Zachman, Business Architecture, SOA and Process and tools such as the IBM Rational software and Adobe products. I also write about my previous life as a mobile and web developer.</description>
			<language>en-gb</language>
			<pubDate>Tue, 09 Jun 2026 06:54:44 -0000</pubDate>
			<lastBuildDate>Tue, 14 Jun 2011 13:37:00 -0000</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>shaun@mccran.co.uk</managingEditor>
			<webMaster>shaun@mccran.co.uk</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>shaun@mccran.co.uk</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			
			
			
			
			<item>
				<title>Using url rewriting ( .htaccess or httpd.ini ) to block hot linking resources</title>
				<link>http://www.mccran.co.uk/index.cfm/2011/6/14/Using-url-rewriting--htaccess-or-httpdini--to-block-hot-linking-resources</link>
				<description>
				
				After my recent move to HostMediaUK I&apos;ve been able to see more in depth statistics about one of my sites, including traffic and data usage. This also includes having visibility of other domains that are linking directly to my content. This is popularly known as hot linking, and if you haven&apos;t asked permission is considered very impolite. 
&lt;p&gt;
This also uses up your servers bandwidth rather than theirs.
This article explores how I use a  URL access file, either .htaccess of http.ini depending on your platform, to stop other domains from linking directly to your hosted resources.
&lt;p&gt;
				 [More]
				</description>
				
				
				<category>Security</category>
				
				<category>Isapi rewrite</category>
				
				<category>Server management</category>
				
				<pubDate>Tue, 14 Jun 2011 13:37:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2011/6/14/Using-url-rewriting--htaccess-or-httpdini--to-block-hot-linking-resources</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>The SEO way to safely redirect a Page or folder using 301 redirects</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/5/10/The-SEO-way-to-safely-redirect-a-Page-or-folder-using-301-redirects</link>
				<description>
				
				In a recent project we are restructuring a site to be more intuitively architected. But what impact will moving the directories or pages have on all that hard earned Search Engine Ranking Optimisation work?

This article deals with how to safely redirect users from an old page or folder to the new URL, and keep Search Engine&apos;s informed of your changes without leading them to dead content (Dead content is bad and will adversely affect your Site rankings).
				 [More]
				</description>
				
				
				<category>Coldfusion</category>
				
				<category>Best practices</category>
				
				<category>Isapi rewrite</category>
				
				<category>SEO Methodologies</category>
				
				<category>Server management</category>
				
				<pubDate>Mon, 10 May 2010 17:09:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/5/10/The-SEO-way-to-safely-redirect-a-Page-or-folder-using-301-redirects</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Passing url variables through Isapi re write - Regular Expression</title>
				<link>http://www.mccran.co.uk/index.cfm/2010/1/28/Passing-url-variables-through-Isapi-re-write--Regular-Expression</link>
				<description>
				
				One of the more common tasks in ColdFusion development is passing variables through the URL string. We are all familiar with the idea that the question mark (?) denotes the url query string start, and that name value pairs are separated with the ampersand (&amp;). 

I usually avoid using this in display templates, as it isn&apos;t great exposing your internal site workings to customers, and with Fusebox it is very easy to pass the URL variables to an &quot;act_&quot; template and remain hidden.

What happens when you want to use dynamic url variables with a URL re writing application like Isapi re write? I&apos;ve been using Isapi re write in some FuseBox framework application, and it is relatively easy to set up a rewrite rule, as shown below.

&lt;code&gt;
RewriteRule home(/) index.cfm?fuseaction=circuitname.circuitfunction
&lt;/code&gt; 

Where the url /home/ would actually serve up the content specified in the fuse specified. But this is hard coded. What about dynamic variables?

We can create a regular expression to handle the translation of the variables.

&lt;code&gt;
RewriteRule destination/(.*)/(.*)/  index.cfm?go=circuitname.circuitfunction&amp;$1=$2
&lt;/code&gt;

We use a similar URL, but append the dollar ($) 1 = dollar ($) 2 string. In the re write rule we specify that appended variables are transposed into the string using the slash (/) as a separator.

So as an example we could pass a product id of 24 into the rule  like this:

&lt;code&gt;
www.siteurl.com/cart/productId/24/
RewriteRule buy/(.*)/(.*)/  index.cfm?go=cart.buy&amp;$1=$2
&lt;/code&gt;

It would be rewritten to the more familiar url string. A handy way of continuing to mask the url.
				
				</description>
				
				
				<category>Coldfusion</category>
				
				<category>Frameworks</category>
				
				<category>Isapi rewrite</category>
				
				<category>Web technologies</category>
				
				<pubDate>Thu, 28 Jan 2010 15:08:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2010/1/28/Passing-url-variables-through-Isapi-re-write--Regular-Expression</guid>
				
				
			</item>
			
		 	
			
			
			<item>
				<title>Using Isapi rewrite to serve up non existing templates</title>
				<link>http://www.mccran.co.uk/index.cfm/2009/12/16/Using-Isapi-rewrite-to-serve-up-non-existing-templates</link>
				<description>
				
				I was discussing some ideas for an application framework this morning with the team, and one of the issues we hit upon was having a common directory for templates, but serving them up as if they were from a different directory. 

The idea is to have one instance of a reusable skinnable template, that appears to live on several sites.

IE all the content lives in &quot;webroot/content/templateName.cfm&quot;, but is actually served up by many sites, IE &quot;127.0.0.1/site1/template1.cfm&quot;, &quot;127.0.0.1/site2/template1.cfm&quot; ... etc

In this way they can be re skinned or adapted as needed, and they aren&apos;t database driven. The main stumbling block for the discussion was the need to actually create blank versions of each of the named templates, in each of the sites, as ColdFusion server would error on the request. 

I spent twenty minutes trying to work it so that my Application.cfc&apos;s onRequest or onRequestStart method would intercept the request before it was actually made, but that just wasn&apos;t working. My other idea was to use the onMissingTemplate method, but the server is only running ColdFusion 7, so that was a no go (I figured I could catch the missing template request and just re path it, although I&apos;d have to assess if that was really inefficient due to almost every page request logging as failed).

My eventual solution was Isapi rewrite. I am re writing all the requests to the same template, and just passing in the template variable. In that way I can request pages that don&apos;t actually exist, but they appear in the url.

Create an index.cfm template like this:

&lt;code&gt;
&lt;h1&gt;I am the index page&lt;/h1&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;page1&quot;&gt;Page 1&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;page2&quot;&gt;Page 2&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;page3&quot;&gt;Page 3&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;page4&quot;&gt;Page 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;cfdump var=&quot;#url#&quot;&gt;
&lt;!--- write a handler to go get the url var passed in ---&gt;
&lt;/code&gt;

For this example I am using the free version of Helicon&apos;s Isapi rewrite, you can get it here: &lt;a href=http://www.helicontech.com/download-isapi_rewrite.htm target=&quot;new_win&quot;&gt;Link to Helicons Isapi re write&lt;/a&gt;

In the example below I have altered the first page link to look like it is actually a .cfm template request, just in case you want the url string to have a .fileextension look to it.

&lt;code&gt;
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.68

RewriteEngine on
RewriteBase /mywebroot

#no physical page testing
RewriteRule page1.cfm(/)? isapitest/index.cfm?p=page1 
RewriteRule page2(/)? /index.cfm?p=page2
RewriteRule page3(/)? /index.cfm?p=page3
RewriteRule page4(/)? /index.cfm?p=page4

&lt;/code&gt;

So when you fire it up and test it you just see /page1, /page2 etc, and the pages don&apos;t actually exist.

I&apos;m not experienced enough with Isapi rewrite to know if there is a downside to this, but bookmarking in  a browser still works correctly, so I can&apos;t see an issues at present.
				
				</description>
				
				
				<category>Software Architecture</category>
				
				<category>Coldfusion</category>
				
				<category>Frameworks</category>
				
				<category>Isapi rewrite</category>
				
				<category>Web technologies</category>
				
				<pubDate>Wed, 16 Dec 2009 13:19:00 -0000</pubDate>
				<guid>http://www.mccran.co.uk/index.cfm/2009/12/16/Using-Isapi-rewrite-to-serve-up-non-existing-templates</guid>
				
				
			</item>
			
		 	
			</channel></rss>