Skip to main content
Inspiring
April 10, 2020
Question

Configure web-site for access without the 'www' domain name prefix

  • April 10, 2020
  • 1 reply
  • 678 views

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/

 

    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    April 10, 2020

    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.

    /Charlie (troubleshooter, carehart. org)