Copy link to clipboard
Copied
Is there a way with ColdFusion to configure a website for access without the 'www' domain name prefix?
I know you normally would change the DNS settings to do this.
But is there a way that if someone goes here
https://mywebsite.com/
That Coldfusion can redirect them to here
https://www.mywebsite.com/
Copy link to clipboard
Copied
This is something usually best handled by your web server, rather than CF. Are you using IIS or Apache, or something else? Look into URL rewrite features for that web server, and you should find ready examples of how to do this.
To be clear, there is no feature in CF to "force such a redirect", but you certainly COULD also/instead handle this in your CFML, by having code in your application.cfc/cfm that detects which domain was used (via any of the various variables in the CGI scope, which you could cfdump to explore), and then just use cflocation to send them to the desired domain instead.
Let us know if either gets you going, or if you have more questions.