How to Remove WWW from the URL in Mura CMS with ColdFusion

Recently, a Mura CMS user asked how to remove the 'www' from the URL. So I thought I would whip up a quick post on how to do it.

  1. Login to the Admin and go to your 'Site Settings' (top-right on yellow toolbar).
  2. Select the site you wish to enforce this rule on.
  3. On the 'Basic' tab, make sure you have 'yourdomain.com' in the 'Domain' field.
  4. Also, make sure you list 'www.yourdomain.com' in the 'Domain Alias List' text area.
  5. Click 'Update'
  6. Now we'll edit a file that would probably be included on each page in your site such as \{siteid}\includes\themes\merced\templates\inc\html_head.cfm
  7. Copy and paste the code below into the top of the file that is located on each page:


<cfscript>
    myDomain = "yourPreferredDomain.com";
    domainIsCorrect = true;
    if ( getPageContext().getRequest().getServerName() neq myDomain ) {
        domainIsCorrect = false;
        urlstr = "http://" & myDomain & getPageContext().getRequest().getRequestURI();
        if ( len(trim(getPageContext().getRequest().getQueryString())) ) {
            urlstr = urlstr & "
?" & getPageContext().getRequest().getQueryString();
        };
    };
</cfscript>
<cfif not domainIsCorrect><cflocation url="
#urlstr#" addtoken="false" statuscode="301" /></cfif>

That's it! Enjoy.

Comments
Thanks for sharing this helpful information. Before coming to your blog I was wondering that do URL with or without www different or effect performance of our website. But now it's clear for me. So I decided to remove www from URL and the above code really works.
# Posted By agnes james | 10/19/12 3:35 AM
Have to getting the full enjoyments to play latest puzzle game this is the part of the latest free online bejeweled 3 games i must be share you some tips for batter score.
# Posted By free games bejeweled 3 | 11/10/18 12:44 AM
The presence of a .cfm file is the thing that triggers Apache to hand off the handling of that record to the ColdFusion Markup Language engine. This is simple stuff I understand, yet that index.cfm bit is essential for this situation since that is what we will wipe out from the URL. http://www.essayempire.co.uk/
# Posted By DavidWillis | 12/10/18 6:08 AM
# Posted By Teri Quinn | 1/23/19 4:01 AM
Incredible Blog truly, I like this blog to such an extent, https://monovm.com/domain/
# Posted By Albert William | 4/7/19 5:34 AM
Domain name business is one of the least known way of making easy money, and that too very quick. https://www.monovm.com/domain/
# Posted By Albert William | 4/7/19 5:36 AM
I tried to remove www from URL with the help of cfscript but I failed. I tried this link https://www.resumeshelpservice.com/topresume-com-r... as an example but I failed to remove www from URL. Can you please tell me another way to remove www from URL.
# Posted By Catherine T. Robinson | 8/21/19 3:38 AM
What a review you shared.
https://www.uk.com/how-do-you-do.html
# Posted By Anna | 1/9/20 1:52 AM
Thanks for sharing this helpful information. Before coming to your blog I was wondering you do URL with or without www different or affect the performance of our website. But now it's clear to me. I am the owner of a real estate company named Mike Keon Realty. We provide property assistance to people for buying and selling property in the USA. <a href="https://mikekoenrealtynj.com/">point pleasant beach realtors</a> Click on the link to see houses available in the USA. Visit my website for further information.
# Posted By Mike Keon | 1/23/20 7:41 AM
Thanks for sharing this helpful information. Before coming to your blog I was wondering you do URL with or without www different or affect the performance of our website. But now it's clear to me. I am the owner of a real estate company named Mike Keon Realty. We provide property assistance to people for buying and selling property in the USA. Click on the link to see houses available in the USA. Visit my website for further information.https://mikekoenrealtynj.com/
# Posted By mike | 1/23/20 7:43 AM
Most people enjoy lots of the chats, My partner and I in fact knowledgeable, I'd personally favor additional information in relation to this kind of, http://www.pallavidutta.in/ given that it really is great., Together with as a result of acquire dispersing.
# Posted By pallavi dutta | 11/5/20 2:57 AM
Knovva Academy offers both online and offline affordable learning facilities to its learners.
# Posted By Career Counseling | 12/25/20 11:39 AM
Thanks for sharing nice work
# Posted By Love Shayari in urdu | 3/1/21 3:06 AM
It's an amazing Post. Hope this website keeps Posting this type of Post.
# Posted By Ahmedabad Escorts | 9/17/21 4:00 AM
if you're asking about CF9's cfmediaplayer tag, then yes, they have an onComplete method to do that.
# Posted By Escorts in Roorkee | 9/17/21 4:02 AM
I'm consistently looking for some free stuff over the web. http://www.hyderabadescortsservice.org/ there are also a couple of associations that give free models.
# Posted By parul sharma | 10/5/21 3:17 AM
Astounding, What an Outstanding post. I found this a great deal of informatics. It is what I was searching for. http://www.ludhianaescorts.co.in/
http://www.escortsinamritsar.com/
http://www.kanpurescort.in/
http://www.agraescort.co.in/ I should propose to you that assuming no one minds, keep on sharing such kind of info. If possible, Thanks.
# Posted By Devi Wilson | 10/5/21 3:18 AM
Nice data-gaining article. http://www.callgirlfriendrelationship.com/ This post is really magnificent on this significant subject
# Posted By parul sharma | 10/5/21 3:19 AM
Nice. Thanks
# Posted By Take Surveys | 10/23/21 9:25 AM

© 2021, Stephen J. Withington, Jr.  |  BlogCFC was created by Raymond Camden – Version 5.9.004

Creative Commons License  |  This work is licensed under a Creative Commons Attribution 3.0 Unported License.  |  Hosted by Hostek.com