Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: Developing with Sitefinity > Sub domains...

Sub domains...

  • Posted on Dec 3, 2007 (permalink)

    I have a site that is split accross multiple sub domains.  I obviously "could" create a separate "instance" of sitefinity for each sub-domain, but I want to create one, big cohesive site with single sign-in access.  In other words, I need them to be able to log in to:

    www.domain.com

    But then have "logged in" access to:
    sub1.domain.com
    sub2.domain.com
    and
    sub3.domain.com.

    I want the search function to search accross all sub domains.  Etc.

    What's the best way to handle this situation?

    Thank you and I look forward to any suggestions that might be available.  Take care.

    EJ

    Reply

  • Bob Bob admin's avatar

    Posted on Dec 6, 2007 (permalink)

    Hi Ben Alexandra,

    Unfortunately, there is no such functionality available out of the box. You could implement this by adding custom HttpModule to load the home page corresponding to each domain. Next, you need to modify the navigational controls to start from the domain’s root page. Also, if you are going to use shared content, News or Blogs that should be specific to each domain, you'll have to add a provider for each domain and specify different application name for each provider. Then permissions can be set per provider.

    We have already tried this approach for a customer and I must say it is not very practical and straightforward. Since there have been quite a lot of requests for such scenarios, we are currently considering providing this functionally out of the box but I can’t promise that it will make it for v3.2.

    However, if you decide to give it a try, I can send you more detailed instructions and a sample project. Note that this approach may not be fully compatible with the one that we will provide later.

    Regards,
    Bob
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • medicalwebgeek Intermediate avatar

    Posted on Jan 10, 2008 (permalink)

    I am trying to do the same thing for a number of projects.  Can you send me the information also?

    Reply

  • Vlad Vlad admin's avatar

    Posted on Jan 11, 2008 (permalink)

    Hello James,

    Here is a basic solution we have provided for one of our clients. You can customize and extend it according to your needs.

    Description of the implemented scenario:
    For example, you have one WebSite and 2 domains pointing to it:
        www.domain1.com
        www.domain2.com

    In the SiteMap you have:
        Root
            domain1 - group page
                default.aspx
                page1.aspx
            domain2 - group page
                default.aspx
                page1.aspx
             
    requesting www.domain1.com opens ~/domain1/default.aspx
    requesting www.domain2.com opens ~/domain2/default.aspx

    The solution works only when the web application is set as a Web Site in the IIS, not a virtual directory.
    The files are attached to this post. You should copy them into the App_Code folder of your site and make the appropriate changes in the web.config, as mentioned below.

    DomainUrlHelper defines the domains mapping and provides helper methods for resolving and unresolving URLs:
    using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.Web.UI.HtmlControls; 
    using System.Collections.Generic; 
     
    namespace DomainMapping 
        /// <summary> 
        /// Summary description for DomainUrlHelper 
        /// </summary> 
        public static class DomainUrlHelper 
        { 
            static DomainUrlHelper() 
            { 
                domains = new Dictionary<stringstring>(); 
                domains.Add("www.domain1.com""domain1"); 
                domains.Add("www.domain2.com""domain2"); 
            } 
     
            public static string ResolveUrl(string url) 
            { 
                string domainRoot = GetDomainRoot(); 
                if (!String.IsNullOrEmpty(domainRoot)) 
                { 
                    return url.Replace(domainRoot + "/"""); 
                } 
                return url; 
            } 
     
            public static string UnresolveUrl(string url) 
            { 
                string domainRoot = GetDomainRoot(); 
     
                if (!String.IsNullOrEmpty(domainRoot) && url.StartsWith("/") && (url.Length > 1)) 
                { 
                    int index = url.IndexOf('/', 1); 
                    if (index > 0) 
                    { 
                        string parentPath = url.Substring(1, index - 1); 
                        if (parentPath.Equals(domainRoot)) 
                        { 
                            return url; 
                        } 
                        else if (domains.ContainsValue(parentPath)) 
                        { 
                            foreach (KeyValuePair<stringstring> pair in domains) 
                            { 
                                if (pair.Value.Equals(parentPath)) 
                                {  
                                    HttpContext.Current.Response.Redirect( 
                                        String.Concat(HttpContext.Current.Request.Url.Scheme, "://", pair.Key, url)); 
                                    break
                                } 
                            } 
                        } 
     
                    } 
                    return String.Concat("/", domainRoot, url); 
                } 
                return url; 
            } 
     
            public static string GetDomainRoot() 
            { 
                string domainRoot = null
                if (domains.TryGetValue(HttpContext.Current.Request.Url.Host, out domainRoot)) 
                    return domainRoot; 
     
                return string.Empty; 
            } 
     
            public static Dictionary<String, String> Domains 
            { 
                get 
                { 
                    return domains; 
                } 
            } 
     
            private static Dictionary<String, String> domains; 
        } 


    DomainUrlRewriteModule overrides GetUrl method to change the rewrite path:
    using System;    
    using System.Data;    
    using System.Configuration;    
    using System.Web;    
    using System.Web.Security;    
    using System.Web.UI;    
    using System.Web.UI.WebControls;    
    using System.Web.UI.WebControls.WebParts;    
    using System.Web.UI.HtmlControls;    
    using Telerik.Cms.Web;    
        
    namespace DomainMapping    
    {    
        /// <summary>    
        /// Summary description for DomainHomePageModule    
        /// </summary>    
        public class DomainUrlRewriteModule : CmsHttpModule    
        {    
            protected override string GetUrl(HttpContext context)    
            {    
                string path = base.GetUrl(context);  
                if (String.IsNullOrEmpty(path))  
                    path = context.Request.RawUrl;    
                path = DomainUrlHelper.UnresolveUrl(path);    
                return path;    
            }    
        }    
    }    
     


    DomainSiteMapProvider inherits CmsSiteMapProvider to change the nodes structure and URLs according to the domain mapping setting:

    using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.Web.UI.HtmlControls; 
    using Telerik.Cms.Web; 
    using Telerik.Cms; 
    using System.Collections.Generic; 
     
    namespace DomainMapping 
        /// <summary>  
        /// Summary description for CustomCmsSiteMapProvider  
        /// </summary>  
        public class DomainSiteMapProvider : CmsSiteMapProvider 
        { 
            //protected override CmsSiteMapNode CreateSiteMapNode(ICmsPage page, CmsSiteMapNode parentNode, string path) 
            //{ 
            //    return base.CreateSiteMapNode(page, parentNode, path); 
            //} 
     
            protected override CmsSiteMapNode CreateSiteMapNode(ICmsPage page, CmsSiteMapNode parentNode, string path) 
            { 
                return new DomainSiteMapNode(this, page, parentNode, path); 
                //return base.CreateSiteMapNode(page, parentNode, path); 
            } 
     
            //protected override CmsSiteMapNode CreateSiteMapNode(Telerik.Cms.ICmsPage page) 
            //{ 
            //    return new DomainSiteMapNode(this, page); 
            //} 
     
            public override SiteMapNode RootNode 
            { 
                get 
                { 
                    SiteMapNode node; 
                    if (this.rootNodes == null
                    { 
                        this.rootNodes = new Dictionary<string, SiteMapNode>(); 
                        node = base.RootNode; 
     
                        foreach (string domainHome in DomainUrlHelper.Domains.Values) 
                        { 
                            node = this.FindSiteMapNode(String.Concat("/", domainHome, UrlHelper.PageExtension)); 
                            if (node != null
                                this.rootNodes.Add(domainHome, node); 
                        } 
                    } 
     
                    string domainRoot = DomainUrlHelper.GetDomainRoot(); 
                    if (!String.IsNullOrEmpty(domainRoot)) 
                    { 
                        if (this.rootNodes.TryGetValue(domainRoot, out node)) 
                            return node; 
                    } 
                    return base.RootNode; 
                } 
            } 
     
            private Dictionary<String, SiteMapNode> rootNodes; 
        } 
     
        public class DomainSiteMapNode : CmsSiteMapNode 
        { 
            public DomainSiteMapNode(CmsSiteMapProvider provider, ICmsPage page, CmsSiteMapNode parentNode, string path) 
                : base(provider, page, parentNode, path) 
            { 
            } 
     
            public override string Url 
            { 
                get 
                { 
                    return DomainUrlHelper.ResolveUrl(base.Url); 
                } 
                set 
                { 
                    base.Url = value; 
                } 
            } 
        } 
    }  
     


    Settings in the web.config:
    ... 
    <httpModules> 
      <add name="Cms" type="DomainMapping.DomainUrlRewriteModule" /> 
    </httpModules> 
    ... 
    <siteMap defaultProvider="CmsSiteMapProvider" enabled="true"
      <providers> 
        <clear /> 
        <add name="CmsSiteMapProvider" description="Displays Cms Pages" type="DomainMapping.DomainSiteMapProvider" /> 
      </providers> 
    </siteMap> 
    ... 


    Please let us know if you experience any problems.

    Greetings,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
    Attached files

    Reply

  • medicalwebgeek Intermediate avatar

    Posted on Jan 12, 2008 (permalink)

    Thanks for the solution.  How can I use it to implement a subdomain?  For example:
    Main domain www.domain.com
    Sub domain department.domain.com

    Thanks.

    Reply

  • Vlad Vlad admin's avatar

    Posted on Jan 14, 2008 (permalink)

    Hi James,

    Regarding this solution, you should not map the main domain to any page, i.e. www.domain.com should open the root of the site (standard Sitefinity functionality).
    Every subdomain should be mapped to an existing page under the root of your application. For example:


     domain/subdomain  page 
     www.domain.com  root
          department.domain.com       departments
          any.domain.com
          any

    Please let us know if you need further information.

    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Posted on Jun 13, 2008 (permalink)

    will mapping to the subpages cause the site to "forward" to that page instead of being an actual subdomain?

    what I want is to be able to have site.com and subdomain.site.com. it is okay if subdomain.site.com maps to site.com/subdomain, that is okay and it makes sense of course... however if someone types in subdomain.site.com, I want them to STAY on subdomain.site.com, and NOT be forwarded to site.com/subdomain.

    can this be done simply or would I have to go the complicated route explained above?

    Reply

  • Vlad Vlad admin's avatar

    Posted on Jun 16, 2008 (permalink)

    Hello Josh,

    Actually, the behavior you require can be achieved using this solution, i.e. when the user types subdomain.site.com, it stays at subdomain.site.com, but when the user types site.com/subdomain, it redirects to subdomain.site.com.

    Please let us know it works differently in your site.

    Greetings,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Mike avatar

    Posted on Jun 17, 2008 (permalink)

    Vlad,

    I am trying to use your posted code and i am running into a problem. If i request the main domain everything works fine, but when i request the subdomain i get an under construction page with the message 

    Thank you for visiting our web site. Please return soon for updates.

    If i try to type in a known path under the subdomain i get a 404 error.

    i modified the DomainUrlHelper  with my domains like so,

     static DomainUrlHelper()  
            {  
                domains = new Dictionary<string, string>();  
                domains.Add("sitefinity.xxx.org", "xxx");  
                domains.Add("employee.xxx.org", "employee");  
            }  
     

    with the xxx being our domain name.

    is it a requirement that the first child page in the page group be called default.aspx? that is the only difference that i can see in my setup versus the explanations you have listed here.

    Any help is greatly appreciated.
    mike

    Reply

  • Vlad Vlad admin's avatar

    Posted on Jun 18, 2008 (permalink)

    Hi Mike,

    Actually, this depends on the IIS settings. For example, if the wild card mapping is not set and the default document is default.aspx for your web site (the default settings), when your request URL: employee.xxx.org the IIS will change it to employee.xxx.org/default.aspx and the implementation bellow will rewrite it to employee.xxx.org/employee/default.aspx. So, in this case, it is a requirement that the first page is called default.aspx.
    However, you can change this behavior by customizing DomainUrlHelper.UnresolveUrl method:

            public static string UnresolveUrl(string url)  
            {  
                string domainRoot = GetDomainRoot();  
      
                if (!String.IsNullOrEmpty(domainRoot) && url.StartsWith("/") && (url.Length > 1))  
                {  
                    int index = url.IndexOf('/', 1);  
                    if (index > 0)  
                    {  
                        string parentPath = url.Substring(1, index - 1);  
                        if (parentPath.Equals(domainRoot))  
                        {  
                            return url;  
                        }  
                        else if (domains.ContainsValue(parentPath))  
                        {  
                            foreach (KeyValuePair<stringstring> pair in domains)  
                            {  
                                if (pair.Value.Equals(parentPath))  
                                {   
                                    HttpContext.Current.Response.Redirect(  
                                        String.Concat(HttpContext.Current.Request.Url.Scheme, "://", pair.Key, url));  
                                    break;  
                                }  
                            }  
                        }  
      
                    }  
                    return String.Concat("/", domainRoot, url);  
                }  
                return url;  
            }  

    Please let us know if you have further questions.

    Greetings,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Mike avatar

    Posted on Jun 18, 2008 (permalink)

    Vlad,

    Thanks for the response. That is in fact good information to know. My question now is the code that you posted is identical to the code you previously posted. Can you tell me what needs to change in order for this to work for me?


    thanks again,
    Mike

    Reply

  • Vlad Vlad admin's avatar

    Posted on Jun 19, 2008 (permalink)

    Hello Mike,

    Basically, you should add a default.aspx page as first child of your employee page.

    However, yes, the code I posted is identical to the previous one. I just marked the code snippet you should change to accomplish your goal. I don't know what are your requirements and settings in the IIS, so I cannot tell you what is the exact implementation.
    For example, if you want to open exactly employee page when requesting employee.xxx.org you should change the marked code with:

    if (url.Equals("/default.aspx", StringComparison.OrdinalIgnoreCase)) 
        return String.Concat("/", domainRoot, Telerik.Cms.Web.UrlHelper.PageExtension); 
    return String.Concat("/", domainRoot, url); 
     

    Hope this is helpful. Let us know if you need further assistance.

    All the best,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Randel Bjorquist avatar

    Posted on Sep 8, 2008 (permalink)

    I'm looking for some help with this.  I'm extremely new to Sitefinity and pretty new to just web development in general.  I've taken the files supplied by Vlad, placed them in my App_Code folder, made the modifications to the web.config file and attempted the the last change to the DomainUrlHelper.cs file, and I still don't get this to work.  I'm getting an "Internet Explorer cannot display the webpage".

    Right now, I have two websites (not virtual directories) setup in IIS, each pointing to the same local windows folder and I believe I have my Sitefinity project setup like explained above.  I do not have a root default page, but do have default pages for each "subfolder".

    I'm looking for any help/pointers to get me moving.

    Reply

  • Vlad Vlad admin's avatar

    Posted on Sep 9, 2008 (permalink)

    Hi Randel,

    You said that you have two websites. Actually this solution is regarding one website and more than one domain pointing to it. The main point is that you should have different domains (or sub domains) to request the same web application.
    Then, after setting the solution in your project, you have to define the website domains in the DomainUrlHelper class, i.e:
        public static class DomainUrlHelper  
        {  
            static DomainUrlHelper()  
            {  
                domains = new Dictionary<stringstring>();  
                domains.Add("www.domain1.com""domain1");  
                domains.Add("www.domain2.com""domain2");  
            }  
    ... 

    Please give us more details about the problems you have experienced.


    Kind regards,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

    Reply

  • Randel Bjorquist avatar

    Posted on Sep 9, 2008 (permalink)

    Hi Vlad,
    Thanks for the quick response and here is what I’m trying to do.  I have an organization “xxx” that I would like to split up into sections: “public”, “students”, “instructors”, etc …  and would like my access/web sites to be: “public.xxx.com”, “students.xxx.com”, “instructors.xxx.com”, etc …

    For the most part, the information belongs to one “authoritative” section/site.  There is however sections that will need to contain section specific information.  What is the best practice or recommended solution for this type of Sitefinity project?  

    The problem I’m having with the sub domain solution is that I’m having problems getting them to work and look like I want.  In my project, I have a couple pages Page Type set to Page Group: “public”, “student”, and “instructor”, each with default pages.  My URLs end up looking like: “public.xxx.com/public/default.aspx”, “students.xxx.com/students/default.aspx”, and “instructor.xxx.com/instructor.aspx”, instead of what I want them to be: “public.xxx.com”, “students.xxx.com”, and “instructors.xxx.com” respectfully.

    I am also starting to look at sharing the database between Sitefinity projects.  Again, what is Telerik’s best practice for this kind of site?  Is it the shared database or the sub domain solution?

    Reply

  • Vlad Vlad admin's avatar

    Posted on Sep 10, 2008 (permalink)

    Hi Randel,

    Seems the "Sub domains..." solution is appropriate to your scenario - you have several domains pointing to one web site, and each domain is mapped to a root-level page.
    Also you could use another approach with separate web sites and shared database.

    Unfortunately we cannot tell you what is the best way to build such kind of web site, because it depends on many factors which cannot be listed.

    Whichever solution you will choose we will be glad to help you if you have any problems.

    Sincerely yours,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

    Reply

  • jas4on avatar

    Posted on Oct 2, 2009 (permalink)

    Are the methods described above still the only way to implement subdomains or has the functionality been added to v3.5+ releases of sitefinity?  If it hasn't been added, I'd like to vote for its inclusion soon.  I think sub and multiple domain support w/o custom code is pretty common standard feature in CMSs these days.

    Thanks

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Oct 2, 2009 (permalink)

    Hi jas4on,

    We have plans to include similar functionality for 4.0. For the time being the only way to get subdomain support is using the code from this post, or better write your custom code.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • jas4on avatar

    Posted on Oct 2, 2009 (permalink)

    good deal....thanks for the quick response.

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Oct 2, 2009 (permalink)

    Hello jas4on,

    Actually you could take a look at the following KB article - Domain-Page mapping. This works in 3.7 and it will do the trick. I hope this helps.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • jas4on avatar

    Posted on Oct 2, 2009 (permalink)

    much better solution than the custom code. Thank you!

    Reply

  • Posted on Dec 1, 2009 (permalink)

    I have added the following to the web.config in the section described in the deployment article:
    <cms defaultProvider="Sitefinity" pageExtension=".aspx" siteTemplate="" ... blah, blah, blah...
       <urlMappings> 
      <add key="subdomain1.MySite.com" value="subdomain1" shared="true" /> 
      <add key="subdomain2.MySite.com" value="subdomain2" shared="false" /> 
       </urlMappings> 

    When I create the "landing pages" for these entries as it stands now, how should I configure them? Should they be pages created immediately off of the root of the Sitefinity site map tree view? Should they be listed in the Navigation (which is not desired)?

    I would like to know how I should be redirecting to these pages or is it automatic after entering the web.config data?

    Thanks,
    Steve

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 1, 2009 (permalink)

    Hello Steve,

    You need to create Cms pages that will be mapped to the domains/subdomains. You can hide the pages in the backend for user that does not belong to administrators role ( page permissions tab).

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Posted on Dec 1, 2009 (permalink)

    Ivan,

    Thanks for your quick reply:

    So if I understand you correctly, I should be able to just create a page named "subdomain1.aspx" just off of the "home" page and then just give it the proper authorization?

    I have selected "Show in navigation" = "No" and "Anonymous access" = "Deny" and when I surf to http://subdomain1.mysite.com I still get the main site's home page. So... I'm doing something wrong it appears.

    I have also created a URL at the bottom of the page settings and it reads "~/subdomain1/subdomain1.aspx". It is set to the default. Since the page is rendered on the fly, I thought that adding the mock folder name is essential.

    Am I understanding the concept correctly?

    It's just not working and this is my first stab at creating pages with subdomains. Please forgive my noobie questions....

    Steve

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 2, 2009 (permalink)

    Hi Steve,

    If you have a page called "subdomain1.aspx" with deny anonymous, not show in navigation and it is associated with subdomain1.mysite.com you have to be redirected to FormsAuthentication loginUrl. The only possible reason for the bahavior you exprience is:

    1. You do not use Sitefinity 3.7 where this logic is implemeted.
    2. You have not changed correctly your Hosts file as described in the KB article.
    3. Note that you have to use IIS server instead of ASP.NET Development server.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Posted on Dec 2, 2009 (permalink)

    Ivan,

    Thank you again for your rapid reply.

    Since my site isn't "live" yet (a work in progress) I have been doing this on DiscountASP.NET -- not locally. I paid DiscountASP.NET the fee for unlimited subdomains and received an IP address and some old VB (classic ASP) script code. 

    Since my last message, I tried making the page visible to others ( and now I am receiving an exception when I type in subdomain1.mysite.com. To me, that is progress because I'm not getting the home page now. <g>

    if the URL generated by Sitefinity for this page is ~/subdomain1.aspx will subdomain1.mysite.com work with my setup the way I described in the urlMappings section above? (i.e. "subdomain1.mysite.com", "subdomain1")

    I don't mean to be a pain, but sometimes I just can't help it <g>.

    BTW: I AM running Sitefinity 3.7 but not the latest SP1 version.

    Steve

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 2, 2009 (permalink)

    Hello Steve,

    The following web.config configuration should not be a problem. I am running it without problems.

    <urlMappings>
       <add key="subdomain1.domain.com" value="subdomain1" shared="true" />
       <add key="subdomain2.domain.com" value="subdomain2" shared="false"/>
    </urlMappings>


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • Posted on Dec 2, 2009 (permalink)

    Ivan,

    Here is my message from later the same day (early evening or about 7:00 PM PST):

    Now that I have created custom templates, my problem is solved! I can now link to regular HTML pages too. This is sparking some excellent ideas too!

    Thank you to the great programming staff of Telerik/Sitefinity for providing this simple and easy solution! Once I got the hang of it, it was like "falling off a log" (easy to do).

    Here is my message from early this morning (5:30 AM PST (or UTC -8) I believe):

    I am now receiving an object error related to a custom membership control on my template I used that is making an assumption (incorrectly I might add... which is my fault). I will try some other things and get back to you.

    Thanks again for your help. I think I'm on the way to resolving the problem.

    Reply

  • Posted on Dec 22, 2009 (permalink)

    I haven't read through this thread entirely, so forgive me please if this was already mentioned.

    If your subdomain starts on a page group, be sure to include the correct child page in the mapping. our subdomain is sub.site.com but it maps to site.com/sub/default.aspx

    as a result, when we mapped to just sub it keep redirecting forever.

    switching the mapping to sub/default fixed the issue immediately (this is on 3.7 SP1)

    <add key="sub.site.com" value="sub/default" shared="false" /> 

    thought I'd add this here in case anyone else has the same problem.

    Reply

  • Posted on Dec 22, 2009 (permalink)

    okay I've been playing with this for a little bit longer and I've hit a snag...

    how do I get "out" of the subdomain? our sitemap doesn't match up with our site navigation menu; we built that manually. so links in the site menu will be linked to /default.aspx for the site home page. however, since this is in the domain-mapped section, it's of course mapping inistead to sub.site.com/default.aspx, which is really site.com/sub/default.aspx

    it appears that there is no way I can use this solution if I have manual links that are relative to the SITE root. am I correct?

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 28, 2009 (permalink)

    Hello SelArom,

    The mapped CMS page behaves as a root of the site. You can use <page_path> to specify a subpage of the mapped page - say /sub/default.aspx. Possible solution could be creating a custom urlMappings

    <urlMappings type="Custom" customService="MyCustomService, App_Code" type="Custom">
        <add key="Sdomain1" value="Page1" />
        <add key="Sdomain2" value="Page2" />
    </urlMappings>

    In your custom class you have to override GetKey(HttpContext context) method and return the sub directory path instead of the Host component.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • William Diaz avatar

    Posted on Dec 31, 2009 (permalink)

    How I can impletement the above but with the persistenceMode="PathPrefix" enabled?

    The domain is showing with out any problems but the subdomain is adding the en prefix and display page not found:

    <

    urlMappings>

     

    <

    add key=www.domain.com value="domain" shared="true" />

     

    <

    add key="subdomain.domain.com" value="subdomain" shared="false" />

     

    </

    urlMappings>

     

    Reply

  • ft_wg avatar

    Posted on Jan 4, 2010 (permalink)

    Hello,

    similar to other users, I want to use one sitefinity instance in order to handle several sub-sites, each having its own navigation structure.

    Example:

    subdomain1.mysite.com ==> Sitemap1 (pages A,B,C)
    subdomain2.mysite.com ==> Sitemap1 (pages A,B,C)
    subdomain3.mysite.com ==> Sitemap2 (pages A,C,D)
    subdomain4.mysite.com ==> Sitemap2 (pages A,C,D)
    subdomain5.mysite.com ==> Sitemap3 (pages E,F)

    I want to enable cms admins/editors to define the assignment of pages to sitemaps.

    After some research i figured the best solution would be to assign roles (never being assigned to users, just as a grouping mechanism) to the pages and use a custom SitemapProvider to filter sitemap nodes according to a subdomain-(1:1)->role-(m:n)->page mapping.

    In order to do this I need access to the roles assigned to a sitemap node. In a preliminary test I used the following code in a standalone aspx page within a siteinity website to test this:

    1 CmsSiteMapProvider provider = CmsSiteMap.Provider;  
    2  
    3 SiteMapNode p = provider.RootNode;  
    4 SiteMapNodeCollection c = provider.GetChildNodes(p);  
    5  
    6 foreach (CmsSiteMapNode item in c)  
    7 {  
    8     Response.Write(item.Title);  
    9       
    10     if (item.Roles != null)  
    11         foreach (var role in item.Roles)  
    12         {  
    13             Response.Write(role.ToString());  
    14         }  
    15     Response.Write("<br />");  
    16

    The problem is, that item.Roles is always null and I cannot find out why.

    So my questions are:
    1) How can I find out the roles assigned to Sitemap Nodes?
    2) Is there a better approach to achieve what I am trying to do?

    Thank you very much,
    Florian


    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Jan 4, 2010 (permalink)

    Hi William Diaz,

    I checked similar scenario at my end using Sitefinity 3.7 SP2 and there were not any problems using PathPrefix for persistenceMode. Does the problem persists if you set persistenceMode to None?

    Generally the result with localization should be www.domain.com/en/ and subdomain.domain.com/en/

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

    Reply

  • J.Hoventer Master avatar

    Posted on Feb 3, 2010 (permalink)

    The SiteMapProvider provided by Vlad seems to work, but the site itself doesn't seem to redirect to the correct sub page. It's still stuck on the root home page.

    I'm implemented all code as suggested and added the sub-domains as told, but the normal home page of the site is appearing except with a limited navigation (as expected).

    Why is the page not redirecting?

    Regards,
    Jacques

    Reply

  • J.Hoventer Master avatar

    Posted on Feb 3, 2010 (permalink)

    We have some real concerns about Sitefinity performance so I wanted to ask the obvious here.

    Does the code provided above affect performance? Would it reduce the speed of page loads?

    And I'm still not able to get the page to redirect to the page group. Any help in that regard?

    Regards,
    Jacques

    Reply

  • bleutiger Intermediate avatar

    Posted on Sep 2, 2010 (permalink)

    I realize this is an old post but toward the end of this post it is talking about what I am trying to do on my site.

    Hello,
      
    similar to other users, I want to use one sitefinity instance in order to handle several sub-sites, each having its own navigation structure.
      
    Example: 
      
    subdomain1.mysite.com ==> Sitemap1 (pages A,B,C)
    subdomain2.mysite.com ==> Sitemap1 (pages A,B,C)
    subdomain3.mysite.com ==> Sitemap2 (pages A,C,D)
    subdomain4.mysite.com ==> Sitemap2 (pages A,C,D)
    subdomain5.mysite.com ==> Sitemap3 (pages E,F)


    can anyone tell me how this can be done?

    Reply

  • Radoslav Georgiev Radoslav Georgiev admin's avatar

    Posted on Sep 3, 2010 (permalink)

    Hello bleutiger,

    I have sent a response to you in the support ticket you have opened with this issue. For the convenience of other users facing the same issue you can find my response bellow:

    What you can do, in the case that you do not want to list pages from the Main Site map , is to use Sitefinity's API to get pages then bind your results to RadSiteMap control for example. You can find more information on how to get pages through the API here: Finding Pages.

    Bellow is an example on how you can get all navigable pages order by the same way they are ordered in the sitemap:

    Copy Code
    CmsManager cmsManager = new CmsManager();
    List<ICmsPage> pages = cmsManager.GetPages().Cast<ICmsPage>().Where(t => t.Navigable = true).ToList();
    pages.Sort((x, y) => x.Ordinal.CompareTo(y.Ordinal));


    Greetings,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Devin Intermediate avatar

    Posted on Nov 25, 2010 (permalink)

    Hi my client would like to have a subdomain that looks like

    www.subdomain.domain.com

    Is this something Sitefinity supports or should it be subdomain.domain.com?

    Thanks!
    Devin

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Nov 26, 2010 (permalink)

    Hi Devin,

    Configuring domains and subdomains has to be done through your host control panel and IIS. Sitefinity is CMS website application that allows you to build the content of the website.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Laura Master avatar

    Posted on Nov 30, 2010 (permalink)

    Maybe this has been answered but i am not sure what method to use.

    I have my main domain and site navigation.

    We have added a subdomain. (configured in IIS and mapped in the web.config)
    This subdomain points to say - www.domain.com/subdomain/
    where subdomain is a pagegroup.

    When on the pages within this pagegroup say  subdomain.domain.com/home.aspx we would like the main navigation links (Rad Menu) to keep pointing to the main domain (www.domain.com) However, I assume that since these page links are generated dynamically, it takes what the domain in the browser is and creates the navigation link that way.  So what was www.domain.com/about_us.apsx is now subdomain.domain.com/about_us.aspx when you are in any sub-pages under the /subdomain/ folder.

    How do I keep the navigation links the same as in the main site but on a subdomain page?
    Thank you.

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Nov 30, 2010 (permalink)

    Hi Laura,

    The SiteMap is split depending on the urlMapping value set in the web.config. You could create a custom menu populated by list of pages returned by CmsManager.GetPages() method instead of using the SiteMap.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Devin Intermediate avatar

    Posted on Dec 3, 2010 (permalink)

    Hi does Sitefinity support the form subdomain.testsite.stagingserver.com?

    Thanks!
    Devin

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 5, 2010 (permalink)

    Hello Devin,

    If you have a license key for stagingserver.com there would not be a  problem.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Devin Intermediate avatar

    Posted on Dec 14, 2010 (permalink)

    OK thanks, I'll work on this.

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 14, 2010 (permalink)

    Hi Devin,

    In this case you need a key for liveserver.com. The other are subdomains of it.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity 3.x: Developing with Sitefinity > Sub domains...