We recently updated one of our intranet web servers, and had to migrate all of the web applications that it supported over to the new server. Setting up ColdFusion and getting the applications running on the new server was no problem, but updating all the links to them was. Unfortunately, the original server was referenced by name rather than an alias. I could have tried to preserve all the links and rename the new server, but I decided that it would be a good time to set up an alias for this resource.

I wanted to make sure that all the users would be redirected to the appropriate application on the new server. So, I used the following technique to accomplish that. For each ColdFusion application I put the following two files in the old application root directory.

Application.cfm
<cfinclude template="index.cfm">
<cfabort>


This will load my index.cfm template file regardless of the url used and then abort. The index.cfm file is a very basic file with a redirect after ten seconds.

index.cfm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This page has been moved!</title>
<META HTTP-EQUIV=REFRESH CONTENT="10; URL=http://webapps.intranet.company.com/ApplicationName/">.
</head>
<body>
<div style="text-align:center;">
<br />
The server servername.company.com has been replaced by webapps.intranet.company.com<br /><br />

Please be sure to update any bookmarks that you may have to this page.<br /><br />
<a href="http://webapps.intranet.company.com/ApplicationName/">
Click here if you are not automatically redirected in 10 seconds.</a><br /><br />
For futher assistance please call the IT service desk.
</div>
</body>
</html>

Tags: Blogger ColdFusion Code

Published: 2009-03-26