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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

multisites possible?


Go to End


107 Posts   35712 Views

Avatar
bummzack

Community Member, 904 Posts

27 July 2010 at 2:03am

That .htaccess from the reply before is not working, because it's setting the RewriteBase to "/"..

Use something like this:

### SILVERSTRIPE START ###
<Files *.ss>
	Order deny,allow
	Deny from all
	Allow from 127.0.0.1
</Files>

<Files web.config>
	Order deny,allow
	Deny from all
</Files>

<IfModule mod_rewrite.c>
	RewriteEngine On
	
	RewriteCond %{REQUEST_URI} ^(.*)$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###

Avatar
stefant42

Community Member, 14 Posts

7 September 2010 at 10:45am

Edited: 07/09/2010 10:46am

I still got a blank site....

I use the _ss_environment.php Method. Without the BASE_DIR hack i got an infinite redirect...

 4 drwxrwsr-x 3 stefan   stefan    4096 2010-07-23 00:27 assets
 0 lrwxrwxrwx 1 stefan   stefan      22 2010-09-06 23:47 cms -> ../../silverstripe/cms
 0 lrwxrwxrwx 1 stefan   stefan      33 2010-09-06 23:48 googlesitemaps -> ../../silverstripe/googlesitemaps
 4 -rw-r--r-- 1 stefan   stefan     419 2010-09-07 00:37 .htaccess
 4 drwxrwsr-x 4 stefan   stefan    4096 2010-09-07 00:35 mysite
 0 lrwxrwxrwx 1 stefan   stefan      27 2010-09-06 23:47 sapphire -> ../../silverstripe/sapphire
36 drwxr-xr-x 2 www-data www-data 36864 2010-09-07 00:44 silverstripe-cache
 4 drwxrwsr-x 5 stefan   stefan    4096 2010-07-23 00:31 themes

My .htaccess

### SILVERSTRIPE START ###
<Files *.ss>
	Order deny,allow
	Deny from all
	Allow from 127.0.0.1
</Files>

<Files web.config>
	Order deny,allow
	Deny from all
</Files>
Options +FollowSymLinks
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /

	RewriteCond %{REQUEST_URI} ^(.*)$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###

Avatar
dompie

Community Member, 88 Posts

7 September 2010 at 10:42pm

index.php is missing in your directory listing. Then it should work.

Avatar
honeybunny

Community Member, 79 Posts

30 September 2010 at 5:18am

I know that this has been done to death and that everybody else seems to have gotten it working with minimal fuss, but I am stuck.

I'm on a shared hosting account with cpanel using linux, apache 2.2.15, php 5.2.13, and SS2.4.2.

I thought I followed banal's very easy, straight forward instructions but can't seem to get past the errors. My questions are 1.) Am I interpreting the instructions correctly?, 2.) Did I code the symlink correctly?

The Directions:
Step 1: Place the following files in their own directory (after reading various comments I'm not sure if this is supposed to be above the root or in the root, but I tried both)
  +- sapphire
   +- cms
   +- googlesitemaps
   +- dataobject_manager
   +- swfupload
   +- _ss_environment.php

Step 2: Place a copy of assets and mysite in each domain's directory

Step 3: Add a symlink to sapphire, cms, googlesitemaps, dataobject_manager and swfupload in each domain's directory.

Step 4: Update the config file for each domain to include require_once('conf/ConfigureFromEnv.php');

Did I at least get this part right?

symlink

Putting the core files (sapphire, cms, etc...) in their own folder created a 500 error because it couldn't find main.php in sapphire. I assumed that this meant that I did something wrong with the symlink, but I don't see how or what I did wrong. All I had to do was replace the username,sourcedirectory and where it needs to link to with my own information and save it as a php file.

<?php symlink('/home/honeybunny/public_html/ss242/sapphire', '/home/honeybunny/public_html/subdomain.com/sapphire');?>

but this is the error message I got:

Warning: symlink() [function.symlink]: File exists in /home/honeybunny/public_html/subdomain.com/sapphire/getfiles.php on line 2

What am I doing wrong? I thought that it was supposed to be symlink('where the file is', 'where you are trying to link it'); I tried placing the paths the other way with the "where I am linking to" part first and the "where the file is" part second, but still got the same error.

I had considered that the problem may be related to permissions, but I wasn't sure which files needed to be 777. I tried making the subdomain's files 777 but got 500 errors, so I reset them and tried changing the main sapphire, cms, googlesitemaps, etc... files to 777 which also resulted in 500 errors so I returned them to their original permissions.

Did I just set everything up wrong? Is my code wrong? I'm on week three of my on again/off again earache and it's really hard to think straight. Any insight into where I am going wrong is greatly appreciated.

HB

Avatar
dompie

Community Member, 88 Posts

30 September 2010 at 6:24am

Edited: 30/09/2010 6:26am

Step 1: Place the following files in their own directory (after reading various comments I'm not sure if this is supposed to be above the root or in the root, but I tried both)
-> Yes, location is best above root but may be anywhere else. Make sure it's readable by the webserver-user (e.g. www-data)

Step 2: great
Step 3: looks good
Step 4: perfect

What did you do with .htaccess? Waht did you do with index.php? You didn't metion it.
.htaccess should be in each subdomain.com/ directory. Either as file or symlinked, same as index.php.

Avatar
honeybunny

Community Member, 79 Posts

30 September 2010 at 7:23am

Hi dompie!

I didn't do anything with htaccess. The htaccess file in the root contains:

### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###

I emptied everything so that I could start from scratch again, but I think the htaccess file in the subdirectory just had

RewriteEngine off

I left it like that because that was what I had to do to get the sub-domain to be recognized as an active domain. (Meaning after it was set up in cpanel, I had to add an htaccess file with RewriteEngine off before I could open a browser and go to www.sub-domain.com and have the file open. This was before I even started playing with using ss to manage the sub-domain.)

As for the index file I used the standard file that loads with ss, One index file was in the root for the primary domain and another was in the sub-domain's folder. No changes were made.

HB

Avatar
dompie

Community Member, 88 Posts

1 October 2010 at 4:25am

Edited: 01/10/2010 4:27am

Looks good to me. I did the same stuff as you described with 2.4.1. The only difference is that it's on a root server, instead of shared hoster. So I'll suggest it's an issue with with the server environment or SS 2.4.2.

Anyway, I have reproduced an internal server error (500). Are you sure your sapphire directory is present in /what/ever/htdocs/you.have.com/ and accessible for webserver-user?

Avatar
honeybunny

Community Member, 79 Posts

1 October 2010 at 3:20pm

Edited: 06/10/2010 7:37am

Thank you so much dompie!
I've more or less got everything working now. Once you said that everything else seemed okay I put everything back the way it was and focused on the symlink.

I started out with:
<?php symlink('/home/honeybunny/public_html/ss242/sapphire', '/home/honeybunny/public_html/subdomain.com/sapphire');?>

but once I thought about it I realized that the link would make the directory (it didn't need to be specified) so I changed the symlink to :

<?php symlink('/home/honeybunny/public_html/ss242/sapphire', 'sapphire');?>

As for my other issues, all I had to do was add an empty folder in the subdomain's directory with the project name and everything worked out fine. I'm not sure why I had to do this, but I did and it worked.

Thanks again, you were a lot of help!

HB

ETA: Really freaky, I took a look at the tables before I called it a day and noticed that the primary domain's db shows utf-8_unicode_ci but the subdomain's db shows latin1_swedish_ci. I have no idea why or how that happened, but it doesn't seem to be bothering anything.