Jump to:

4951 Posts in 14058 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » base url problem

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

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

Page: 1
Go to End
Author Topic: 4703 Views
  • la_fayette
    Avatar
    Community Member
    5 Posts

    base url problem Link to this post

    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.

  • la_fayette
    Avatar
    Community Member
    5 Posts

    Re: base url problem Link to this post

    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

  • Tonyair
    Avatar
    Community Member
    81 Posts

    Re: base url problem Link to this post

    Up!
    Is anyone found solution?

  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: base url problem Link to this post

    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

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: base url problem Link to this post

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

  • kcd
    Avatar
    Community Member
    54 Posts

    Re: base url problem Link to this post

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