I have searched for this everywhere but all I can find is related to .htaccess files. The server my website is hosted on is not using Apache so I can not use an .htaccess file.
I am trying to send people to the www version of my site whenever they type in the non-www domain. So if user types domain.com it will send them to www.domain.com. The problem is that they both are already pointing to the same coldfusion file.
I have a redirect set up that works but it is a 302 redirect:
<cfif cgi.server_name eq "mydomain.com">
<cfset cgi.server_name="www.mydomain.com"/>
</cfif>
If i change the cfset to:
<cflocation statuscode="301" url="www.mydomain.com"/>
it creates an infinite redirect loop and I get an error page.
I need to use a 301 redirect so that Google will not double index my page and say that I have duplicate content as it sees the www and non-www as two seperate sites even though it points to same file. Also a 301 redirect will transfer link authority from the non-www to the www domain.
cgi.server_nameis not an attribute of cflocation so its not going to work like that. - haxtbh