[Solved] Magento 2 Admin 404 Not Found Error – How to Fix It

404 error page not found magento

Despite successfully installing your Magento site, you may still get this error 404 Page Not Found in admin’s pages. There are several reasons why it occurs. It’s better to know the cause first, so we’ll go into that and then show you the suitable solutions.

Problems & Solutions For 404 Error Page Not Found In Admin

Issue 1: Result of installing/ updating Magento extensions

You’ll run into the 404 error in one of the following cases:

  • After installing a new Magento extension
  • Upgrading an extension
  • After applying Magento 2 core or extension patches.

Solutions

  • Flush Magento 2 Cache via the Command Line
php bin/magento cache:clean
rm -rf var/cache/*
rm -rf var/generation/*

Then flush cache: Admin > Systems > Cache Management.

Log out then try logging in again to see if the error is gone.

In a few cases, the issue may be:

  • The compilation hasn’t been restarted

For this situation, use this command to check if the production mode is activated: php bin/magento deploy:mode:show

If it shows the current applied mode is production, run php bin/magento deploy:mode:set production. The applied mode is now set again, you can log out and try re-accessing the admin page.

  • An incorrect admin URL

You probably applied the wrong admin URL, leading to the 404 error to happen. Run the following command to learn a correct URL leading to the Admin Panel: php bin/magento info:adminuri

Issue 2: New installation on Ubuntu, CentOS, Debian

The ‘404 Error Page Not Found’ message will appear when you try to access a page after an installation on Ubuntu or other systems. The cause is that your server hasn’t enabled rewrite mode.

we're sorry, the requested url was not found on this server

Solutions

  • Enable rewrite mode

Use this command line

sudo a2enmod rewrite
  • Edit configuration file

Run command sudo vi /etc/apache2/apache2.conf to edit the Ubuntu file /etc/apache2/apache2.conf

Change from

<Directory /var/www/>
     Options Indexes FollowSymLinks
     AllowOverride None
     Require all granted
</Directory>

to

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Now you need to restart Apache: sudo service apache2 restart or sudo /etc/init.d/apache2 restart

Issue 3: Incorrect permission role settings

Because the role isn’t configured correctly, you may encounter the 404 error in the Magento backend.

Solution

You can solve this issue by resetting the permission role of your administrator.

  • Step 1: Go to the Admin Panel> Systems> Permission> User Roles
  • Step 2: Select the role name that needs to be edited, e.g.: ‘Administrators’
  • Step 3: Switch to the ‘Role Resources’ menu. Set the ‘Resource Access’ to ‘All’.
  • Step 4: Click Save.
  • Step 5: Clear cache and check again for the error.

Issue 4: Messy frontend

While we’re familiar with the scenario where issues in the backend affect the frontend, it can be the other way around. For instance, the 404 error may result from a messy frontend page.

404 page not found the page you requested was not found

Solution

Try running this command line to fix the issue:

php bin/magento setup:static-content:deploy

Wrap Up

This tutorial has gone through all 4 reasons which may cause the Magento 2 “404 error page not found” in the Admin page. If you’ve been in this situation, the mentioned solutions can be helpful.

For more useful guides to handling common Magento issues such as fixing the deadlock error when reindexing all, fixing missing all sale tables but sale orders are recorded error, check out our blog!

Read more: