How to Force Mura CMS to Use Primary Domains in SEO-Friendly Way

Mura CMS allows you to have multiple URLs assigned to each particular site. For example, you could have be your 'primary' domain and and set up as 'domain aliases' so that when you navigate to any one of these domains, Mura will serve up the desired site. This is pretty cool actually and there are a number of use cases out there on why you would want that to happen. However, if you want the 'primary' domain to be the one and only one used for SEO purposes and such, then you'll need to make just a couple of minor tweaks to make that happen. The best part is, I'll show you just how easy this is!

The first thing you'll need to do is copy the following method into your local contentRenderer.cfc. It's located at /{siteid}/includes/contentRenderer.cfc (or if you want this to be 'theme-specific' then edit the one located at /{siteid}/includes/themes/{themeName}/contentRenderer.cfc).

<cffunction name="doEnforceDomain" access="public" output="false" returntype="any" hint="By default, I will redirect users in an SEO-friendly way to your primary domain ... you may optionally override this by giving me an alternate 'primary' domain to enforce.">
    <cfargument name="domain" required="false" default="#$.siteConfig('domain')#" />
        var local = StructNew();
        local.doRedirect = false;
        local.servername = getPageContext().getRequest().getServerName();
        if ( local.servername neq arguments.domain ) {
            local.doRedirect = true;
            local.servername = arguments.domain;
            local.baseurl = getPageContext().getRequest().getScheme() & '://' & local.servername;
            // if not using a standard port, we should prolly include it
            local.port = getPageContext().getRequest().getServerPort();
            if ( local.port neq '80' and local.port neq '443' ) {
                local.baseurl = local.baseurl & ':' & local.port;
            // uri returns '/index.cfm/path/to/page/'
            local.uri = getPageContext().getRequest().getRequestURI();
            local.urlstr = local.baseurl & local.uri;
            // append query string, if any
            if ( len(trim(getPageContext().getRequest().getQueryString())) ) {
                local.urlstr = local.urlstr & '?' & getPageContext().getRequest().getQueryString();
    <cfif local.doRedirect>
        <cflocation url="#local.urlstr#" addtoken="false" statuscode="301" />
        <cfreturn />

The last thing you'll need is an itsy-bitsy, teeny-weeny line of code that can actually be dropped in a number of different places. More on that in a second. However, if you want your entire site to always use the primary domain, then drop the following line of code into your local eventHandler.cfc in the onRenderStart() method. This is located in the same locations as the contentRenderer.cfc.

<cffunction name="onRenderStart">
    <cfargument name="$" />
    <cfset $.getContentRenderer().doEnforceDomain() />

Remember how I mentioned you could drop this in a number of different places? Well, let me explain. Let's say you have an area of the site that uses a particular template and you want ONLY that area of the site to use a specific domain...for example '' for a documents area. Well instead of using the eventHandler.cfc route, you could just drop this at the top of the template and then anytime someone visits this area, they'll get re-routed properly and in a SEO-friendly manner. Isn't that sweet?


As always, I hope this helps!


This is really awesome Steve, and something that I have been wishing that the BR guys would roll into Mura's base code.
# Posted By Dave Long | 4/26/11 11:15 AM

Well, considering I''m one of those 'Blue River' guys...I guess I should get on the ball then, eh?

I'll see if there's a clean way to implement something like this into the core. Maybe make the method available, and even have a radio option in the Site Settings for each site or something. Hmm.

# Posted By Steve Withington | 4/26/11 9:04 PM
Thanks Steve. Very useful.
# Posted By Jeff | 6/23/11 9:34 AM
Steve, thanks for this great piece of code.
I made one modification because the site I am using it on does not use "index.cfm" in the URLs.

I added:
<cfset local.urlstr = replacenocase(local.urlstr,"/index.cfm","")>

right after <cfif local.doRedirect> in the contentRenderer.cfc

that keeps it from adding in the "index.cfm" in the 301 redirect
# Posted By Jeff Pierson | 1/10/12 7:43 PM
SEO considers how search engines function, the PC modified calculations which direct search engine behavior, what people look for, the genuine inquiry terms or keywords typed into search engines.
# Posted By Write my Assignment Now | 1/22/18 5:24 AM
I think there are numerous other individuals who are occupied with them simply like me! To what extent does it take to finish this post, I trust you keep on having such quality articles to share!
# Posted By Assignment Writing Help UK | 2/20/18 5:10 AM
I endless like these sorts of posts which are made out of key encased work with the target that everybody can welcome it, a dedication of gratefulness is all around to post such an astounding idea. I'll be viewing the chance to be tied up with your assistance and I believe you post again soon.
# Posted By Essay Writing | 2/20/18 7:29 AM
Thanks for sharing this fact. I simply loved the way you defined the subject. It has correct information and also it's miles very interesting to examine. you have got maintained an amazing fine in an attractive manner. preserve sharing.
# Posted By Online Essay Company | 2/26/18 6:27 AM
Howdy! This post couldn't be written any higher! analyzing this publish reminds me of my preceding roommate! He continually stored speak me about this. I can ahead of this write-up to him. pretty positive he could have a great examine. Many thank you for sharing!
# Posted By Do My College Essay For Me | 2/26/18 6:34 AM
I'm sincerely inspired by this nicely-written and well-defined article on martial law. I was looking for data concerning a few records martial within the west due to the fact I've to finish my assignment in this subject matter.
# Posted By Pay for Essays in Australia | 2/26/18 6:36 AM
The data and the detail had been beginning past due difficult. I feel that your attitude is focal, its starting overdue well completely considered and simply strengthening to see some character who knows how to put those examinations down so nicely. tough to miss address this.
# Posted By Homework Tutor | 3/1/18 12:50 PM
It’s very excellent information and more real facts to provided that post.Thank you for sharing this information.
# Posted By SY0-501 braindumps | 5/8/18 5:12 AM
The Leading Assignment Help UK Firm Offers State Of The Art Services To Its Clients With A Promise Of Delivering All The Required Work Well Within The Deadline.
# Posted By Online Economics Project Help | 6/28/18 4:04 AM
Great Info! I Recently Came Across Your Blog And Have Been Reading Along. I Thought I Would Leave My First Comment. I Don’t Know What To Say Except That I Have
# Posted By Online Marketing Homework Help | 6/28/18 7:39 AM
The Arabic numerals have rounded lines and blend with the overall temperament. Elegant and unique, it is very eye-catching. A 3-point calendar display window at 3 o'clock adds practical functionality to the disc.
# Posted By replica watches uk | 7/23/18 2:08 AM
nice post thanks
# Posted By plombier neuilly sur seine | 9/17/18 7:06 PM
Such A Nice Post, Keep Providing Good Resources.
# Posted By Managerial Accounting Homework Help | 10/16/18 1:12 AM
My Friend Recommended This Blog And He Was Totally Right Keep Up The Fantastic Work!
# Posted By Take My Mechanical Project | 10/16/18 5:58 AM
nice post thanks very much
# Posted By choisir un bon chirurgien esthétique en tunisie | 10/18/18 10:12 AM
Cool post! By the way, if you need a professional help with writing essays or others kinds of papers we are ready to help you!
# Posted By Essays Masters | 10/20/18 12:55 PM
great information thanks :) :)
# Posted By | 10/23/18 6:04 AM
nice post thanks very much :) :)
# Posted By chirurgie esthetique tunisie | 11/7/18 11:02 AM
Programming Assignment Help is efficient in reducing stress from your academic life. It can save most of your time. Hence you can utilize your time in other necessary works. However, it is essential to choose a proper service; else it can trouble you badly. To avoid this, you must check the online reviews for a better Computer Science assignment.
# Posted By programming assignment help | 11/26/18 5:40 AM
you can go through reviews. It will help you to know about the services, and it will help you to know whether that site is reliable or not. This is a way of understanding the opinion of users, and it helps the website to maintain its functionality and reliability.
# Posted By AllAssignmentHelp reviews | 11/27/18 6:09 AM
You should study in a way that you do not compromise with your health. Good health is a prerequisite for you to be able to study efficiently and to maintain motivation to do so. Sometimes, assignments also act as a hindrance in following your timetable. In such situations, you can take assignment help.
# Posted By Assignment Help | 11/27/18 6:09 AM
Get online assignment writing service from top academic assistance provider company My Assignment Help OZ. We provide you authentic assignment service according to university requirement.
# Posted By online assignment help | 12/13/18 7:48 AM
Facing Sims 3 - Error Code 12, 16, 13 , 12 & 15 errors when saving the game on your Windows PC, follow this step by step guide to fix won't ...
# Posted By fix here | 12/24/18 6:30 AM
great info thanks
# Posted By avocat divorce | 1/23/19 5:12 AM
It is easy to understand, detailed and meticulous! I have had a lot of harvest after watching this article from you! I feel it interesting, your post gave me a new perspective! I have read many other articles about the same topic, but your article convinced me! I hope you continue to have high quality articles like this to share with veryone!
# Posted By MangaFox | 3/7/19 3:29 AM
Buy online homework helper for write best homework. We provide homework helper service in Australia. Our experts easily do your homework. Experts write high-quality work. Our writers hold master and Ph.D. degrees from the top universities across the globe.
# Posted By Australia Assignment help | 4/2/19 5:23 AM
great one
# Posted By Dr Malek | 4/30/19 10:11 AM
Original work guaranteed without a single sign of plagiarism
# Posted By gerda stern | 5/6/19 7:32 AM
aking a loan online is dangerous when you don’t know anything about the company. Remember: if you take microcredit online, your risks increase.
# Posted By loans online | 5/6/19 7:45 AM
Academic requirements can levy a tremendous amount of strain and pressure on the mental well-being of students. No matter how hard they try to divest themselves of these overbearing stresses, they always fall victim to them. A big reason for this is the way educational setups and curriculums have been devised. But, we have good news for you! There is no longer a reason for you to break under pressure, simply trust Done Essays to come to your assistance. With our one-of-a-kind write my essay service, you can have all your writing-related issues resolved within a jiffy!
# Posted By Susanne McGuire | 5/9/19 2:15 AM
hello!,I really like your writing very much! proportion we keep up a correspondence extra approximately your article on AOL? I need an expert on this house to solve my problem. Maybe that's you! Having a look ahead to see you.
# Posted By advertising rates in singapore | 5/21/19 2:04 AM
hi This post is Great.
# Posted By Surat Escorts | 7/2/19 12:01 PM
Beautiful Post, Thank yuo!
# Posted By Surat Call Girls | 7/11/19 8:04 AM
Great . i loved this.
# Posted By Gurgaon Call Girls | 7/22/19 9:42 AM
Book Mg Road Escorts, Mg Road escorts agency has top girls in the city for in-calls and out-call where you can choose my 24/7 escorts in Mg Road.
# Posted By Mg Road Call Girls | 7/23/19 5:24 AM
We are providing you call girl in Indore through Escort Rides Agency. Those Indore Escorts also offer high-quality call girls in affordable rates. If you want to make your night colorful, contact the Escort Rides Agency's agent, which offers escorts service in Indore. Thank you.
# Posted By Indore Call Girls | 8/1/19 5:45 PM
Goa Escort stylish model Independent Goa escorts call girls,Goa escort make your night full with high quality fun.
# Posted By call girls in Goa | 8/2/19 5:32 AM
Avast Premier 2020 is a strong security collection with some excellent added functions such as the cam blocker and also the enhanced Do Not Disrupt setting. I'm not so certain the boosted anti-phishing function is comparable to it must be, as its outcomes were mixed in my quick experience with the attribute. Still, the screening residences offer Avast high marks as well as general the business has a fantastic online reputation as a solid security item.
# Posted By Avast 2020 | 8/18/19 10:05 AM
You are a very intelligent person! <b><a href=" Your Referral Traffic</a></b>
# Posted By Measure Your Referral Traffic | 8/29/19 4:11 AM
When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get three e-mails with the same comment. Is there any way you can remove me from that service? Appreciate it!
# Posted By Having a responsive web design | 8/30/19 1:31 AM
I’ve learn some good stuff here. Certainly worth bookmarking for revisiting. I surprise how much effort you place to make this sort of fantastic informative website. <b><a href=" higher rankings in Google</a></b>
# Posted By get higher rankings in Google | 8/30/19 6:00 AM
The subsequent time I read a blog, I hope that it doesnt disappoint me as a lot as this one. I mean, I do know it was my choice to read, however I truly thought youd have one thing interesting to say. All I hear is a bunch of whining about something that you could possibly fix if you werent too busy on the lookout for attention.
# Posted By Google related searches | 9/2/19 5:26 AM
I love your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz respond as I'm looking to create my own blog and would like to find out where u got this from. cheers
# Posted By bhakut Dosha | 10/10/19 1:22 AM
# Posted By Ahmedabad Escorts | 11/6/19 12:40 PM
# Posted By Vadodara Escorts | 11/6/19 12:41 PM
I am not sure where you are getting your information, but good topic. I needs to spend some time learning much more or understanding more. Thanks for magnificent information I was looking for this information for my mission. <a href=" Steel Sheet</a>
# Posted By Stainless Steel Sheet | 1/27/20 1:03 AM
Appreciating the time and effort you put into your blog and detailed information you offer. It's awesome to come across a blog every once in a while that isn't the same old rehashed material. Fantastic read! I've saved your site and I'm including your RSS feeds to my Google account.
# Posted By Titanium Pipe | 1/28/20 12:45 AM
Call Girls in Raipur booking service helpline any time, the new enjoyment, inclination for call girl lovers. Choose best, sexy new youn Raipur call girls.
<a href="">Call Girls in Raipur</a>
# Posted By Jassy Gracen | 2/8/20 8:00 AM
We are a fantastic luxury and one of the best kolkata escorts agency. Our escorts in Kolkata agency providing amazing, sexy and #1 escorts in Kolkata.
# Posted By Renu Das | 2/9/20 6:32 AM
I have known about the sites of alto and it's background for a while now. But I still like reading the content on , it is very interesting. And everytime I visit it I come across something new about the site.
# Posted By kevin | 3/12/20 2:09 AM
Hey very nice site!! Man .. Excellent .. Amazing .. I will bookmark your website and take the feeds also…I am happy to find a lot of useful info here in the post, we need work out more strategies in this regard, thanks for sharing. . . . . .
# Posted By dumex | 3/30/20 10:03 PM
Everything has its value. Thanks for sharing this informative information with us. GOOD works!   
# Posted By AP pharma-d web counselling | 4/2/20 3:48 AM
I think you have the potential to become of the best writers, but you need to work hard on subjects. It may seem like something you can't do now, but you'll be able to do it soon.
# Posted By | 6/2/20 7:07 AM
Uttarakhand 11th 12th Class Previous Model Question Papers and Syllabus Download Students can Score Better in the Final Examination 2021 with the Help of the UK 11th 12th Model Question Paper 2021. with the Help Of UK 11th 12th Model Question Paper 2021 Students Can Easily Know About the Proportion Of Question Asked From Each Unit and Students would Also be Aware Of the Percentage of Objective and Theory Based Questions Asked in the Examination 2021   
# Posted By vps servers | 6/3/20 6:51 AM
Uttarakhand 11th 12th Class Previous Model Question Papers and Syllabus Download Students can Score Better in the Final Examination 2021 with the Help of the UK 11th 12th Model Question Paper 2021. with the Help Of UK 11th 12th Model Question Paper 2021 Students Can Easily Know About the Proportion Of Question Asked From Each Unit and Students would Also be Aware Of the Percentage of Objective and Theory Based Questions Asked in the Examination 2021
# Posted By vps servers | 6/3/20 6:51 AM
thanks for this usefull article, waiting for this article like this again.
# Posted By AP pharma-d web counselling | 6/11/20 11:43 AM
Here you will learn what is important, it gives you a link to an interesting web page:    <a href=" Patches</a>
# Posted By Custom Patches | 7/12/20 2:41 PM
# Posted By enjoy with girl | 8/18/20 7:48 AM
that is the high-quality article thank you for sharing this informative information. i am able <a href="">; Escorts in Mumbai </a> go to your weblog often for some cutting-edge placed up.
# Posted By Escorts In Mumbai | 8/31/20 9:20 AM
I read this article. I think You put a lot of effort to create this article. I appreciate your work.
Very interesting information, worth recommending. However, I recommend this:
# Posted By turntable setup | 10/12/20 12:44 PM
Thanks for your insight for your fantastic posting. I’m exhilarated I have taken the time to see this. It is not enough; I will visit your site every day.
# Posted By catwoman costume eartha kitt | 10/15/20 12:18 PM
I visit your blog regularly and recommend it to all of those who wanted to enhance their knowledge with ease. The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers!
# Posted By tratamento para alcoolismo | 10/18/20 10:36 AM
I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks!
# Posted By Catalyst Private Investigations | 10/21/20 9:43 AM
Recently, I have commenced a blog the info you give on this site has encouraged and benefited me hugely. Thanks for all of your time & work.   best drink driving lawyer Auckland
# Posted By More | 10/29/20 12:23 PM
Recently, I have commenced a blog the info you give on this site has encouraged and benefited me hugely. Thanks for all of your time & work.
# Posted By SGTGLOBAL | 11/8/20 5:05 AM
Very nice post I really enjoyed it...You can also visit my website for.
# Posted By Ravi Sharma | 12/9/20 5:12 AM
I’ve read some good stuff here. Certainly worth bookmarking for revisiting. I wonder how much effort you put to create such a excellent informative site.
# Posted By make your own necklace | 12/25/20 2:27 AM
I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite certain I’ll learn many new stuff right here! Good luck for the next!
# Posted By employee rewards program | 1/22/21 12:42 AM
You can certainly see your skills in the work you write. The world hopes for even more passionate writers like you who aren't afraid to say how they believe. Always go after your heart.
# Posted By solidworks training | 2/13/21 12:31 AM
Kolkata escorts -The beautiful lady of our agency is always ready for you. -
# Posted By Amrita Arora | 3/16/21 11:49 AM" target="_blank"> <a href="" target="_blank">">xxx</a> []BB[/url] keyword
# Posted By charlibilson | 3/24/21 3:00 AM
# Posted By charlibilson | 3/24/21 3:01 AM
Great post. I would include that 'Extraordinary synthesis is a pleasure to the eye' as well; that is the reason we have each one of the styles and outline slants to make it is a pleasant. Undertaking for readers.
# Posted By Homes in Gurgaon | 3/31/21 5:43 AM
You actually make it appear so easy with your presentation but I in finding this topic to be really something which I feel I'd by no means understand. It seems too complicated and very broad for me. I'm taking a look ahead to your subsequent publish, I will attempt to get the hold of it!
# Posted By disinfection services singapore | 5/6/21 9:29 PM
I've found my answer here

# Posted By escortic massage | 6/10/21 3:23 PM
Guys just sharing, I've found this interesting! Check it out!
# Posted By escort girls | 6/12/21 6:36 AM
Hi there, just was alert to your weblog thru Google, and found that it's really informative. I am going to watch out for brussels. I will be grateful in the event you continue this in future. Lots of folks will likely be benefited out of your writing. Cheers!
# Posted By energy booster drink | 6/21/21 12:29 AM
Get me in your Bedroom…. My name is Anupreet Kaur and you can get me in your bed through a booking with Mumbai Escorts. You should hire me to play with my sexy body and I will make you pleased with my actions. You can have fun with Mumbai Escorts Service by hiring me from the website.
Visit Us:-
# Posted By Mumbai Escorts | 8/30/21 2:44 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