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.

All other Modules /

Discuss all other Modules here.

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

Subsites and SS 2.4 - 500 error


Go to End


14 Posts   4681 Views

Avatar
bones

Community Member, 110 Posts

21 May 2010 at 1:31am

I've successfully installed and set up the Subsites module, and I have added a subdomain via my hosting (using cPanel X). The document root is /public_html/subdomain and I have left it "not directed".

However, trying to access www.subdomain.domain.com brings up a 500 Internal Error. If I change the subdomain direction to www.domain.com/subdomain (which is the path to the subdomain), Silverstripe doesn't recognise it as being a subdomain and thinks it's trying to open a page.

Am I correct in thinking that I need to set up the subdomain with the hosting cPanel, or does this need to be done a different way?

Many thanks.

Avatar
honeybunny

Community Member, 79 Posts

21 May 2010 at 6:53am

Hi Bones!
I've temporarily given up on the subsites module (am/was using SS2.4 with latest trunk of subsites), but if you add an htaccess file with just "RewriteEngine off" to the subdirectory created by cPanel you should be able to access the subdomain url.

I can't say whether you need to set up a subdomain with your host to make the subsites module work. (maybe that was part of my problem...) In my case I have two domains with email hosted as subdomains of my main site so I have to have the subdomains set up in cPanel... I tried it both ways in the subsites module and neither worked. (both 500 errors) I eventually gave up and just left the main site to be managed through SS and the subsites to be loaded directly to their respective directories on the server.

Good Luck!

HB

Avatar
bones

Community Member, 110 Posts

21 May 2010 at 8:27am

Thanks for your reply.

I've tried editing the .htaccess as you suggest (and many other ways too), and either get a 404 or a listing of the directory (which of course is empty).

I appreciate that subsites is a pre-release module, but even so, the lack of information on it is very frustrating.

If I find a solution, I promise to post it back here (or hopefully some kind soul will come to our aid).

Avatar
honeybunny

Community Member, 79 Posts

21 May 2010 at 9:44am

Bones,
A 404 error is a move in the right direction. (Okay, that's just my opinion, but at least the domain is being recognized by the server.) I can't tell from your original post whether you are trying to access the subsite via the subsites module, or if you are just opening a browser and typing in the url. If you are trying to reach it through the browser you will need to add an index.htm page to your subdomain's directory in order to clear the page not found error. A basic "hello world" is sufficient to let you know that the subdomain is set up and working.

Now that I've thought about it, I'm wondering if you might need to add an index.php page to the subsite directory. It seems like one is included with the SS package when you set up the main site. I guess I thought that the index page for the subsite would be created within the subsites module, but maybe it isn't. Maybe that is where I went wrong. I know that you need the htaccess file with "RewriteEngine Off" to get the subdomain to be recognized or work on the server, but it hadn't occurred to me that I would need to add anything else. I've already uninstalled the module, but maybe you could give it a try to see if it works.

HB

Avatar
Willr

Forum Moderator, 5523 Posts

21 May 2010 at 8:55pm

Now that I've thought about it, I'm wondering if you might need to add an index.php page to the subsite directory

No you shouldn't need to. All requests - from either the main site or any subsites should point the the same installation of SilverStripe.

If you get a 500 internal error look at your error logs for the actual error message. You should be able to use subdomain.domain.com if its set to the same folder as domain.com. Sorry I can't provide any more information for cPanel. I've only ever deployed Subsites to VPS's or dedicated machines so you can mess directly with the virtualhost file.

Avatar
bones

Community Member, 110 Posts

22 May 2010 at 12:39am

I'm so close on this now!

I have added a subdomain using cPanel, and disabled redirection. This creates a folder of the same name on the root.

I have added a .htaccess to that folder, the content of which is:

<IfModule mod_rewrite.c>
	RewriteEngine Off
	RewriteBase /
</IfModule>

I then copied the index.php file from the root (created by Silverstripe) into the new folder, changing the following lines:

define('BASE_SCRIPT_URL','index.php/');

to
define('BASE_SCRIPT_URL','/www.domain.com/');

which fixes the links to images to the assets folder

and

require_once('sapphire/main.php');

to
require_once('../sapphire/main.php');

which fixes the link to sapphire.

Now, when I access www.subdomain.domain.com, I am shown the content of the subsite and images, but the link the theme is broken ie the broken link is
http://www.subdomain.domain.com/index.php/themes/themename/css/stylesheet.css
when it should be
http://www.domain.com/themes/themename/css/stylesheet.css

So SS is correctly providing the subdomain content and images correctly, but can't access the theme.

I haven't yet tested to see if everything else (ie forms) work on the subdomain.

Can anybody help me just finish off this last bit please?

Avatar
ClearSky

Community Member, 6 Posts

27 May 2010 at 4:28pm

I think if you should try to create subdomain.domain.com as a domain alias of domain.com in cPanel.

Avatar
bones

Community Member, 110 Posts

28 May 2010 at 1:29am

Hi ClearSky. I've got all of that part working now (see above), it's just that the links to the stylesheets (and possibly other links) aren't working on the subdomain.

My client has now decided to that he wants them all on separate hosting now, so the subsites part of the project has been abandoned.

Go to Top