Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » How to use subdomains?

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1781 Views
  • DHirsch
    Avatar
    1 Post

    How to use subdomains? Link to this post

    Hello all,

    Is there a way to utilize subdomains within a single SilverStripe installation? Since SS does not support multi-level directory hierarchies yet, I'm looking for a way to 'organize' the site and separate some of the content. So ideally, I could have:

    www.mainsite.com/page1
    www.mainsite.com/page2
    .....
    affiliate.mainsite.com/page78
    affiliate.mainsite.com/page84

    but page78 and page84 would not be available on www.mainsite.com. Is this possible? I searched the forum and docs and didn't see many references to using subdomains.

    Thanks!

    Daniel

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: How to use subdomains? Link to this post

    There is the option in the 'Behaviour' tab on any page for specifying a domain, or multiple domains.

    However, am I correct in assuming you want to block off certain pages dependant on the domain you're currently on? If that's the case, we don't have that certain functionality, but we do have the ability to do what you're looking for half of it.

    Sean

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: How to use subdomains? Link to this post

    You could use modify the Access system that comes with 2.1 to do this.

    Or you could use the subsites module that is in Subversion/Dailybuilds, which would do exactly what you want; it allows you to run several websites from the one installation and share content/structure between the two. However, we've not yet had time to properly document it...

    Finally, do realise that silverstripe is really quite OO and built to let you play and achieve what you want; rather that come up with every possible idea someone needs, we give you the framework to let you do it yourself

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: How to use subdomains? Link to this post

    What do I write in that field 'domains'?

    Suppose I want the page http://www.mysite.com/test/ to be http://test.mysite.com

    Do I write:

    test
    test.mysite
    http://test.mysite.com

    It's not clear to me what the field expects...

    And anyone experience with doing this in combination with dreamhost and setting up subdomains there?

    I've setup the subdomain in the panel and it works, but it's not pointing to the page of my SS-site, which seems logical as the subdomain is just a new directory in my root folder

    so I have the directory 'mysite' and besides that, on the same level, 'test.mysite' so it makes sense to me that it doesn't work....

    If I change it so that the directory of the subdomain points to www.mysite.com/test/ then I get an error when visiting the page

    sapphire/main.php was not found on this server.

    Which seems logical because there is nothing in that directory...

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: How to use subdomains? Link to this post

    Ok,

    apparently I have to point my subdomain to the same root as the main domain..
    so both have to point to the root of the mysite.com/ directory.

    I probably want the base-tag to stay the same though (www.mysite.com), but that can't be too hard.

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: How to use subdomains? Link to this post

    Dio5, can you document which of the following was needed?

    > Do I write:
    > test
    > test.mysite
    > http://test.mysite.com

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: How to use subdomains? Link to this post

    yeah sure:

    test.mysite.com

    Apparently, RootURLController.php checks for $_SERVER['HTTP_HOST'];
    The field in the backend just goes into a single field in the database table of SiteTree.

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: How to use subdomains? Link to this post

    Sweet ...

    1781 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.