I have changed the admin URL using the below command line:

php bin/magento setup:config:set --backend-frontname="admin_path"

I have followed the below answer for change the admin URL:

How to change magento2 admin url?

After that I have gone to check the admin URL stored correct or not in this file app/etc/env.php .

Also, I have run these commands after update the URL

  1. php bin/magento setup:static-content:deploy
  2. php bin/magento cache:c
  3. php bin/magento cache:f

The URL has changed as expected but now I am getting 404 Not Found page when I go the updated admin URL.

Please suggest if anyone faced this issue in past.


Make sure that after you do the command:

php bin/magento setup:config:set --backend-frontname="admin_path"

You go to the Database and

select * from core_config_data;

and have the correct:


with your url. And of course doing the:

php bin/magento cache:flush



Make sure HTTPS is configured correctly. If not it redirects to 404 Not found page.

Note - If HTTPS is not required(in local), configure the url with HTTP for both fields 'web/unsecure/base_url' and 'web/secure/base_url' in core_config_data or in admin. And also disable - web/secure/use_in_adminhtml in core_config_data table.

Go to the Database:

  1. select * from core_config_data;
  2. correct the path:
  • web/unsecure/base_url
  • web/secure/base_url with http url.
  1. Clear the cache - php bin/magento cache:flush

Thanks! Nithin Ninan


I found myself facing the 404 error after a

php bin/magento setup:config:set --backend-frontname="admin_path"

no cache cleaning or flushing mattered. So finally I simply downloaded the app\etc\env.php and manually edited the path there:

'backend' => 
array (
    'frontName' => 'admin_path',

some cache clean and flush and you're good to go. Hope it helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.