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.

Installing SilverStripe

Getting SilverStripe up and running on your computer and on your web server.

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

base url problem


Reply

6 Posts   4808 Views

Avatar
la_fayette

19 July 2009 at 1:50am Community Member, 5 Posts

Hello.

I have silverstripe installed on a shared host. As the website is not finished, it is currently residing on http://test.rainyday.at. My problem is that the base url is http://test.rainyday.at/silverstripe/, I rather want only http://test.rainyday.at.

The funny thing is that if you enter links manually like: http://test.rainyday.at/design it works, but silverstripe automatically sets it to http://test.rainyday.at/silverstripe/design.

I guess the problem has to do something with the rewrite engine. The silverstripe installation resides in the following location on the server: /home/"username"/public_html/silverstripe. Within the directory there is a .htaccess with the following rewrite commands:

RewriteEngine On
RewriteBase /

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

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

In the /home/"username"/public_html/ directory there is another .htaccess file with the following rewrite commands:

RewriteEngine on
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^(www\.)?test\.rainyday.at$ [NC]
RewriteCond %{REQUEST_URI} !^/silverstripe/ [NC]
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{DOCUMENT_ROOT}/silverstripe%{REQUEST_URI}/ -d
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R,L]
RewriteCond %{HTTP_HOST} ^(www\.)?test\.rainyday.at$ [NC]
RewriteCond %{REQUEST_URI} !^/silverstripe/ [NC]
RewriteRule ^(.*)$ /silverstripe/$1 [L]

Both .htaccess files were automatically generated! I am not an expert in this rewrite engine stuff, but I guess in the later commands is something, which disturbs the base url????

It would be amazing if there is anybody out there, who can help. I am already fed up with this issue.

Avatar
la_fayette

24 July 2009 at 4:46am Community Member, 5 Posts

the variable $_SERVER['SCRTPT_NAME'] holds the value '/silverstripe/sapphire/main.php'. The first part /silverstrpe is too much, therefore the BaseURL is computed wrong. Is there a way to change this?

I have already tried to set the BaseURL like this: Director::setBaseURL("http://test.rainyday.at/"). This works fine until the point I want to login to the admin section. I can't log in anymore.

Has anybody a solution?

thanks a lot

Avatar
Tonyair

25 July 2010 at 10:18pm Community Member, 81 Posts

Up!
Is anyone found solution?

Avatar
TotalNet

26 July 2010 at 10:17am Community Member, 181 Posts

The silverstripe installation resides in the following location on the server: /home/"username"/public_html/silverstripe.

Your issue seems to stem from the server setup.

What directory is your web-root? i.e. when you go to http://test.rainyday.at, what directory is that content being served from? /home/"username"/public_html or /home/"username"/public_html/silverstripe?

for a start, remove (keeping a copy safe somewhere) /home/"username"/public_html/.htaccess and see if that gets you anywhere, if not the it'll be down to the web-root and install location.

@Tonyair, are you having a similar issue?

hth

Rich

Avatar
Bambii7

3 August 2010 at 2:12pm Community Member, 254 Posts

That .htaccess looks a little different to mine. I know when there has already been a .htaccess file in the directory where I'm installing SS, SS seems to merge the two. From the point where the second "RewriteEngine On" begins looks like a server generated .htaccess. Try making a back of the file first :) then replace everything inside the htaccess with this code

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

Avatar
kcd

1 February 2011 at 3:16pm Community Member, 54 Posts

To keep Silverstripe in a subdirectory see http://silverstripe.org/installing-silverstripe/show/12328#post283997