Do you have example code for redirects?

There are many ways to write code for redirects.  In the members section of cfdynamics.com, under FAQ we have sample code that you may use and modify.  Below is that code.  The code is for Cold Fusion.

<cfscript>
switch (cgi.server_name)

// This is a server variable. Do not change this line.
{

// Change this section for your first domain alias.
case "www.FirstSite.com": case "FirstSite.com":
aliasRedirect = "FirstSiteLocation/index.htm";
break;

// Change this section for your second domain alias.
case "www.SecondSite.com": case "SecondSite.com":
aliasRedirect = "SecondSiteLocation/index.htm";
break;

// This section is for the default site, usually your primary domain.
default:
aliasRedirect = "";
}//end switch
</cfscript>

<!--- The following line will redirect the browser to the directory
mentioned above. --->
<cfif len(aliasRedirect)>
<cflocation url="#aliasRedirect#">
</cfif>


Was this article helpful?

mood_bad Dislike 0
mood Like 1
visibility Views: 6782