Silverstripe Version: 4.5.0
Question:Change Admin URL Error
Hi there!
I tried to change the admin url according to the instructions “https://docs.silverstripe.org/en/4/developer_guides/customising_the_admin_interface/cms_architecture/”.
As described, the call {myurl}/admin unfortunately generates an error.
Emergency] Uncaught InvalidArgumentException: Missing spec class
GET / admin
Line 404 in /var/www/vhosts/mesekenhagen.de/neu.mesekenhagen.de/vendor/silverstripe/framework/src/Core/Injector/Injector.php
I found two solutions to this problem:
1.
‘admin’: ‘Silverstripe \ CMS \ Controllers \ RootURLController’
This does not generate an error message. However, the URL remains, which is an unusual behavior.
Therefore I have as solution no. 2:
I created my own controller that generates a 404 error. This behavior really corresponds to an incorrect call of a website.
<?php
/**
* AdminErrorController
**/
namespace {
use SilverStripe\CMS\Controllers\ContentController;
class AdminErrorController extends ContentController
{
protected function init()
{
parent::init();
$this->httpError(404);
// $this->redirect('/','302'); // ALTERNATIV
}
}
}
This is now called via ‘admin’: ‘AdminErrorController’ and generates a 404 page as desired.
Alternatively, a 302 redirect to / could occur - which then also represents an atypical behavior.
Perhaps the instructions in the guides could be adapted accordingly.
Nevertheless, there are a few problems, which is why I cannot use the URL rewriting yet.
In the “Assets” area there is only an error message “An unknown error has occurred”. Not more.
And with Pages / History nothing is shown anymore. Only the SS symbol turns.
I have not yet been able to determine whether other areas will no longer work after the URL change.
I ask for information whether someone has already run the admin URL rewriting without errors. Or a few tips on what other configurations are necessary.
Thank you!