13

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)

10 Answers 10

18

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
16

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>

to

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

After this run command

sudo service apache2 restart

IF STILL ADMIN SHOW 404 NOT FOUND, FOLLOW THIS STEP

1) Add .htaccess at root of magento 2

https://github.com/magento/magento2/blob/2.3-develop/.htaccess

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
3

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)

2

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
1

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
1

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

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

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

1

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
0

Just try http://127.0.0.1/ instead of http://127.0.0.1 which worked for me

0

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/

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.