4621 Posts in 1397 Topics by 1392 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2891 Views |
-
[Solved]Unable to access Silverstripe Admin

2 December 2009 at 1:32am Last edited: 3 December 2009 1:28am
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? -
Re: [Solved]Unable to access Silverstripe Admin

3 December 2009 at 1:26am Last edited: 3 December 2009 1:29am
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. -
Re: [Solved]Unable to access Silverstripe Admin

3 December 2009 at 5:03am
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.
-
Re: [Solved]Unable to access Silverstripe Admin

3 December 2009 at 5:21am
per IRC I added "Security::setDefaultAdmin("admin", "password");" in _config,php which allowed my to access the page.
Thanks guys for the quick response!
| 2891 Views | ||
|
Page:
1
|
Go to Top |

