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

503

Likes

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
Adobe Community Professional ,
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 (server troubleshooter, carehart.org)

Likes

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