I hope I’m not spamming too much with basic questions
I’m trying to change the redirect link after logout from admin area.
The logout button under sitename.
I tried accessing with this example but I mainly get the error: LeftAndMain subclasses (CustomAdmin) must have url_segment.
Basically I wish to redirect to home page and not to login form after logout.
use SilverStripe\Admin\ModelAdmin;
class CustomAdmin extends ModelAdmin
{
private static $menu_title = 'My Custom Admin';
}
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Security\IdentityStore;
class LogoutController extends Controller
{
public function index(HTTPRequest $request)
{
Injector::inst()->get(IdentityStore::class)->logOut($request);
$this->redirect(Director::BaseURL());
}
}
I found out that this solution works only on a local machine (WAMP). Does anybody know what would be the correct rule to catch this and route to my custom controller?