Jump to:

4952 Posts in 14256 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » [Solved]Unable to access Silverstripe Admin

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: 3818 Views
  • Ti Aya
    Avatar
    Community Member
    2 Posts

    [Solved]Unable to access Silverstripe Admin Link to this post

    Hello folks,
    I've been successfully running a silverstripe website for a couple of months, until there was upgrade on the web server. Due to the change on .htaccess file, all the links on my site were modified and appear as http://www.mydomain.com/<subdir>/<page-title>;, that is, the subdir where included in the links. At this time, I was able to connect to the Silverstripe on http://www.mydomain.com/<subdir>/admin, but not on http://www.mydomain.com/admin. Now I've fixed the .htaccess file, but I still can't connect to the admin on http://www.mydomain.com/admin. I just return to the login page without any error message. I also found nothing about in the Apache logs.
    How can I gain access to the Silverstripe admin?

  • Ti Aya
    Avatar
    Community Member
    2 Posts

    Re: [Solved]Unable to access Silverstripe Admin Link to this post

    In fact the problem occurred because I added the following code in mysite/_config.php.

    Director::setBaseURL('http://my.domain.com/');

    I solved the issue by replacing this code with

    define('RELATIVE_SUBDIR', '<subdir>');

    And I modified the method baseURL() in sapphire/core/control/Director.php

       static function baseURL() {
          if(self::$alternateBaseURL) return self::$alternateBaseURL;
          else {
             $base = dirname(dirname($_SERVER['SCRIPT_NAME']));
             if($base == '/' || $base == '/.' || $base == '\\') $baseURL = '/';
             else $baseURL = $base . '/';
             // Start custom code
             if(defined('RELATIVE_SUBDIR') && substr($baseURL, 0, strlen(RELATIVE_SUBDIR)) == RELATIVE_SUBDIR)
                $baseURL = substr($baseURL, strlen(RELATIVE_SUBDIR));
             // End custom code
             if(defined('BASE_SCRIPT_URL')) return $baseURL . BASE_SCRIPT_URL;
             else return $baseURL;
          }
       }

    Now my url's are http://www.mydomain.com/<page-title>; and In can access the admin.
    I work with SS v2.3.1.

  • g4m3c4ck
    Avatar
    Community Member
    11 Posts

    Re: [Solved]Unable to access Silverstripe Admin Link to this post

    I just installed a fresh copy of SS version 2.3.4. During the installation process I used 'admin' as the user name instead of an email address like it said I could. However, after the installation process, I followed the link to the CMS admin page and used the credentials it suggested. I receive 'I'm sorry, but you can't access that part of the CMS. If you want to log in as someone else, do so below'

    wth?

    I tried finding "Director::setBaseURL('http://my.domain.com/');" but it is not even in the file.

    Attached Files
  • g4m3c4ck
    Avatar
    Community Member
    11 Posts

    Re: [Solved]Unable to access Silverstripe Admin Link to this post

    per IRC I added "Security::setDefaultAdmin("admin", "password");" in _config,php which allowed my to access the page.

    Thanks guys for the quick response!

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