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.


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.

|improve this answer|||||

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


|improve this answer|||||

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.