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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Installing SilverStripe /

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

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

[Solved]Unable to access Silverstripe Admin


Go to End


4 Posts   4864 Views

Avatar
Ti Aya

Community Member, 2 Posts

2 December 2009 at 1:32am

Edited: 03/12/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?

Avatar
Ti Aya

Community Member, 2 Posts

3 December 2009 at 1:26am

Edited: 03/12/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.

Avatar
g4m3c4ck

Community Member, 11 Posts

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.

Attached Files
Avatar
g4m3c4ck

Community Member, 11 Posts

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!