I installed Magento successfully, but the Admin page gives error: 404 not found. Please suggest a solution for this.

The following is the error:

404 Not Found

nginx/1.10.0 (Ubuntu)

14 Answers 14


Please try Below steps

  1. Delete var/cache folder
  2. Go to database SELECT * FROM core_config_data WHERE path = 'web/seo/use_rewrites' and make it 0
  3. Then enter url in your browser magento_base_url/index.php/your_admin_url

try and let me know if you face any issue.

  • What does this web/seo/use_rewrites value do? – Niels Oct 4 '18 at 9:04
  • 1
    @Niels it will remove index.php from url if it sets to 1 – Murtuza Zabuawala Oct 4 '18 at 10:32
  • @MurtuzaZabuawala Still i am getting same error where i need to focus? – zus Nov 19 '19 at 10:20
  • @zus please check backend=>frontname in app/etc/env.php file – Murtuza Zabuawala Nov 19 '19 at 13:33
  • @MurtuzaZabuawala I serve magento2.4 using php internal server with command php -S localhost:8080 -t pub, I tried your solution, but still get 404 when request localhost:8080/index.php/magento2/admin_1ibt8z – Vidy Videni Jul 27 '20 at 4:01

For Linux edit the file /etc/apache2/apache2.conf

To edit this file use sudo vi /etc/apache2/apache2.conf command

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


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

After this run command

sudo service apache2 restart


1) Add .htaccess at root of magento 2


2) Now run this command

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

rm -rf var/cache/*

rm -rf var/generation/*

  • what are you talking about???? nginx ≠ apache – MagenX Dec 22 '17 at 19:44
  • 1
    Agreed. The OP references Nginx. But as I did have the same problem with Apache 2.4, what I found worked was a) a2dismod rewrite (even though it was enabled!), then b) restart Apache, then c) a2enmod rewrite and then d) restart Apache again. This solved the problem and it was the second time I encountered this on a new install of Apache. And clear cache and pray of course :) – Oliver Williams Feb 24 '18 at 11:35
  • First two steps fixed my problem, thanks! – TawabG Sep 1 '19 at 17:35

Other possible solution is to check for .htaccess file in root directory and add if it doesn't exists (https://github.com/magento/magento2/blob/2.2-develop/.htaccess)


I also had this issue, it turned out one of my URLs was set to the IP address and not to the domain name so going to the {domain}/admin was returning not found.

Solution was to run

php bin/magento config:set web/secure/base_url https://domain.com/
php bin/magento config:set web/unsecure/base_url https://domain.com/

Don't forget the trailing slash, it will not work without it https://alanstorm.com/invalid-base-url-value-must-be-a-url-or-one-of/

  • this fix worked for me after migrating an old 2.0.15 installation to 2.2.x. During the setup the un-secure url did not have https:// protocol and was the default, the admin url, in the advanced section was configured to use https:// but they BOTH need to be set to be https otherwise page not found issue occurs. – Dominic Clifton Oct 20 '18 at 14:57
  • Yes, thanks, I had too many stores to change and I forgot web/unsecure/base_url where the scope_id is 1 – Gabor Juhasz Nov 3 '20 at 14:41

Check if the mod_rewrite module is enabled in Apache. To enable mod_rewite module, go to httpd.conf file located at /etc/apache2/httpd.conf and look for "LoadModule rewrite_module libexec/apache2/mod_rewrite.so", if it is commented, then uncomment it by removing # at the front.

  • The OP was about Nginx - but as I mentioned above to @Prince Patel, the thing that worked for me was: 1. a2dismod rewrite 2. service apache2 restart 3. a2enmod rewrite 4. service apache2 restart - seems that disabling and enabling rewrite does the job. – Oliver Williams Feb 24 '18 at 11:37

Hope this will help you

bin/magento setup:static-content:deploy Run this command In your CLI

  • Curious, how is this a solution for the admin returning a 404? – Tisch Aug 6 '18 at 8:11

First you have to remove content from var/cache and var/session folder ,then change execute this command from commandline/terminal

bin/magento setup:static-content:deploy

  • 2
    Curious, how is this a solution for the admin returning a 404? – Tisch Aug 6 '18 at 8:11

I am also same issue. I updated value for "admin/url/custom" to 0 in core_config_data table and my issue resolved.


Just try instead of which worked for me


Below is the quick one that I had faced with v2.2.5 and fixed like below.

Go to

cd /your-project-root-folder/app/

and fire

chmod -R 755 etc/

I had a similar issue, as well. For me removing the all var folder by: rm -rf var/ and clearing all browser cache: Cmd+Shift+Delete or Command-Shift-Delete for mac, did the trick.

I hope it will help someone!


go check you /app/etc/env.php file backend[front_name => admin_kjdfk]. and use this, like base_url/admin_kjdfk


Check if admin/url/custom is empty and admin/url/use_custom is set to 0.


Why nobody talk about ?

bin/magento info:adminuri

This will display your adminuri. More info can be found here.

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.