ColdFusion redirect – cflocation

Adobe ColdFusion

Adobe ColdFusionI had to change the domain of a longstanding ColdFusion site with hundreds of pages. With .htaccess on an Apache Linux host this is easy and well documented. With ColdFusion on IIS when you are not a full administrator of the IIS server…. not so much.  My searches found post after post with the same instruction, how to redirect an individual page or an entire domain to one single new URL. Whaaatttt!? Why you no care about your customers and visitors!

Adobe cflocation doc – not exactly chocked full of details

Google returns a lot of sites with the simple but not very helpful nuclear option:

<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="">

Then I found a rare post on Katzwebservices with details on how to redirect a single page, prefix all pages with www or  https and how to properly redirect an entire website:

The Author of the code gives a shout to Ben Nadel and can be found in the comments here:

I used the code there and ended up with the below to redirect all pages from an existing site and forums on domainA to domainB. Google picked it up within 2 days and all pages are now listed with Thank you Ben Zadel and  Zack Katz!

<!--- If site is --->
<cfif (CGI.SERVER_NAME EQ "")>
<!--- Save the URL (and $_GET variables too) as the string 'strUrl' --->
<cfset strUrl = CGI.script_name & "?" & CGI.query_string />
<!--- Use 301 for SEO-friendly redirects --->
<cfheader statuscode="301" statustext="Moved permanently">
<!--- Redirect to new website (this case, added www.) with strUrl added on --->
<cfheader name="Location" value="">
<!--- If site is --->
<cfif (CGI.SERVER_NAME EQ "")>
<cfset strUrl = CGI.script_name & "?" & CGI.query_string />
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="">

Gallery 3 – Online photo organizer


GalleryGallery 3 is an excellent Open Source photo management and organizing tool. If you like to manage your photos on your website then G3 may be for you. Check out my Photo Gallery for an example!

About Gallery 3

Gallery 3 User Guide

Gallery 3 Modules

Gallery 3 – Tips and tricks

Speed tips and tricks
See this thread in the Gallery Forums
Use Gallery settings in: application/config/config.php + .htaccess for header expires + CSSMin to cleanup CSS files.

SEO Optimization
Improve URLs, pagination links, pages titles and more

Breadcrumb length
G3 trims breadcrumbs to 15 characters.  To change, edit the following:
Admin -> Settings -> Advanced -> Module = Gallery,  Name = visible_title_length

Slideshow – Add text link to Slideshow icon
This method exposes the already existing “View SlideShow” text, you only need modify CSS as below. Another method would be to replace the ico completely by uploading your own.
Gallery  View Slideshow

Edit File: theme/css/screen.css
#g-view-menu a {
background-repeat: no-repeat;
background-position: 10% 50%;
height: 28px !important;
/* width:43px !important; */ }
#g-view-menu #g-slideshow-link {
background-image: url('../images/ico-view-slideshow.png');
width:134px; !important;

Replace existing “Full sized” (source) image with different image
I’m not aware of how to upload a different Full Sized image in G3 without rebuilding all images for the entire site after you upload, if you know how let me know!

  1. Replace your existing source image using FTP /gallery/var/albums/*album-name*/*image*
  2. Use phpMyAdmin to access your G3 database
  3. Browse to ‘g3items’
  4. Find you image. I used a SQL search for the Slug field:[sql]SELECT * FROM `g3items` WHERE slug=&quot;Your-image-title&quot; [/sql]
  5. Click the edit (pencil) icon
  6. Set the Height and Width attributes to your new image size.

Full sized images – disable
By default Gallery 3 re-sizes your uploaded images as defined in your theme settings. All images then link to the “fullsize” original upload.  There is also an icon which links to the full sized image. Many like myself optimize images locally, upload and only want that version available. Here’s how.

Method one:  Deny access to unregistered users, still uses server optimized/resized images.
Album Options -> Permissions -> uncheck “View Full Size” for “Everyone”

Method two: Remove fullsize links, options and display images you’ve optimized in Photoshop or other dedicated pixel management tools.

  1. Re-sized image – you no longer need the re-sized image that Gallery auto creates with every upload. This step is not required but will save upload time and disk space.
    Go to: Appearance > Theme Options > Resized image size > set the size to 1.
  2. photo.html.php
    – Remove JavaScript and IF statement lines 3 to 26.
    – Replace all code within g-photo DIV with the following – removing all FullSize code and calling your image directly not a resized version from /var/resizes/

    <?php defined("SYSPATH") or die("No direct script access.") ?>
    <div id="g-item">
    <?= $theme->photo_top() ?>
    <div id="g-photo"><img src="<?= $item->file_url() ?>" alt="<?= $item->title ?>" class="g-resize" width="<?= $item->width ?>" height="<?= $item->height ?>" /></div>
    <div id="g-box" style="width:<?= $item->width ?>px;">
    <div id="g-info">
    <h3><?= html::purify($item->title) ?></h3>
    <div><?= nl2br(html::purify($item->description)) ?></div>
    <?= $theme->paginator() ?>
    <div id="g-view-menu" class="g-buttonset ui-helper-clearfix">
    <? if ($page_subtype == "photo") : ?>
    <?= $theme->photo_menu() ?>
    <? endif ?>
    <?= $theme->photo_bottom() ?>
  3. screen.css – set icon display to none on line 840
    #g-view-menu .g-fullsize-link {display:none;}

Web Developer Extensions for Firefox



I browse with Google Chrome but use Mozilla Firefox for the development tools below as the tools either don’t exist for Chrome or lack features.

Web Developer

Web Developer



Yslow from Yahoo


Page Speed from Google

Page Speed

ColdFusion 8 Data Source with MS SQL Express 2005


After upgrading my development system from ColdFusion MX and MS SQL 2000 to ColdFusion 8 and MS SQL Express 2005 I was getting the dreaded SQLServer JDBC Driver errors. The fix is in the Adobe link below – custom config the TCP/IP settings. In my case I used the existing “Dynamic port”

Connection verification failed for data source: {data source name}
java.sql.SQLException: [Macromedia][SQLServer JDBC Driver]Error
establishing socket. Connection refused: connect
The root cause was that: java.sql.SQLException: [Macromedia][SQLServer
JDBC Driver] Error establishing socket. Connection refused: connect

SQL 2005 TCP Settings
– Protocols for SQLEXPRESS
– Set “Enabled” to “Yes” For IP1 & IP2
– Note the port for IPALL
SQL Express TCP IP Config

ColdFusion Datasource
– SQL Server Port
ColdFusion 8 Datasource SQL Port SQL 2005