I want to find out where does Magento2 keeps it's admin path in the database?
Any suggestions will be appreciated.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
I don't think Magento 2 admin path is stored in the database.
You can find the randomly generated path in the
app/etc/env.php file, e.g.:
'backend' => array ( 'frontName' => 'admin_1ai8c5', )
Also an easy way to retrieve the admin path is by using the following Magento 2 CLI:
php bin/magento info:adminuri
If like me you could not access the admin, you will need to add a
core_config_data configuration with the path:
INSERT INTO `core_config_data`(`scope`, `scope_id`, `path`, `value`) VALUES( 'default', # Or whatever your Scope is 0, # Or whatever your Scope ID is 'admin/url/use_custom', 1 ); INSERT INTO `core_config_data`(`scope`, `scope_id`, `path`, `value`) VALUES( 'default', # Or whatever your Scope is 0, # Or whatever your Scope ID is 'admin/url/custom', 'https://my.url.com/newadminpath/' );
Then run the CLI command:
php bin/magento setup:config:set --backend-frontname="newadminpath" php bin/magento maintenance:enable php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento maintenance:disable