Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

How to use subdomains?


Go to End


8 Posts   2182 Views

Avatar
DHirsch

1 Post

28 September 2007 at 5:00pm

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

Avatar
Sean

Forum Moderator, 922 Posts

28 September 2007 at 5:30pm

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

Avatar
Sigurd

Forum Moderator, 628 Posts

30 September 2007 at 8:00pm

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 :)

Avatar
dio5

Community Member, 501 Posts

1 December 2007 at 2:18am

Edited: 01/12/2007 2:37am

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...

Avatar
dio5

Community Member, 501 Posts

1 December 2007 at 3:31am

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.

Avatar
Sigurd

Forum Moderator, 628 Posts

4 December 2007 at 3:37pm

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

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

Avatar
dio5

Community Member, 501 Posts

5 December 2007 at 11:01am

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.

Avatar
Sigurd

Forum Moderator, 628 Posts

5 December 2007 at 11:41am

Sweet ...