• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Participant ,
Apr 10, 2020 Apr 10, 2020

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/

 

Views

551

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2020 Apr 10, 2020

Copy link to clipboard

Copied

LATEST

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation