If you don’t have access to mod_rewrite or an isapi rewrite plugin, you may be forced to use some of the built in ColdFusion functions to force a redirect.Â Today I had a customer who wanted to force all traffic through the www. portion of their domain.Â Examples of doing this are below:
You’ll want to do this on your onRequestStart function so it gets checked on every page
<cfif CGI.SERVER_NAME eq "domain.com"> <cfoutput> <cflocation url="http://www.#cgi.HTTP_HOST##cgi.PATH_INFO#" statuscode="301" addtoken="no"> </cfoutput> </cfif>
The benefit of this method is that it should work equally well with subdomains and URL parameters attached.
You can use the same thing as above in an Application.cfm file, just put it by the top so its processed first.