I have many domains (www.vf1.com, www.vf2.com, www.vf3.com etc) which all point to my main domain (www.vf.com). How do I do a 301 redirect from these other domains to my main domain?
So if someone hits www.vf1.com/news/1234 they should get redirected to www.vf.com/news/1234
I also have domains such as images.vf.com, css.vf.com and js.vf.com that I don't need redirecting
I'm using ColdFusion 8 on IIS (but I don't have access to IIS at the moment)
I tried the below on a URL such as http://www.festivalreviews.co.uk/latest/news/14500 but it gets redirected to http://www.virtualfestivals.com/index.cfm
<cfif cgi.http_host IS 'www.festivalreviews.co.uk'>
<cfset jjURL = 'http://www.virtualfestivals.com' & CGI.PATH_INFO>
<cfheader statuscode="301" statustext="Moved Permanently">
<cfheader name="Location" value="#jjURL#">
</cfif>
Thanks
Since ColdFusion 8, I use <cflocation> (because CF8 added the statusCode attribute) for these kinds of redirects.
<cflocation> documentation: https://wikidocs.adobe.com/wiki/display/coldfusionen/cflocation