0

I have installed Magento 2 locally. I imported the database, changed the URL, and so on. Everything works fine - each subpage loads. Unfortunately, the admin doesn't work. The page just shows 404. This is just a 404 as if the page just wasn't there (eg localhost/blabla and localhost/admin show the same).

I changed the admin's address to "admin", I cleaned the cache - still the same. Everything works except the admin page.

Logs show no errors. I have a .htaccess file. Does anyone have an idea what else could be wrong?

PS. I found a solution. Old values (old address) remained in the database in some places in core_config_data. Of course, these values were only as secure_base_url / base_url (probably via the multistore).

2
  • did you confirm your admin value from app/etc/env.php file?
    – S.P
    Commented Feb 13, 2022 at 18:27
  • In your case it should be backend' => [ 'frontName' => 'admin' ],
    – S.P
    Commented Feb 13, 2022 at 18:27

1 Answer 1

0

1. Flush and Clear Magento Cache by Command line

php bin/magento cache:clean

rm -rf var/cache/*

rm -rf var/generation/*

2. Enable Rewrite mod and configure htaccess file
Modify 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>

3. Replace the URL
This:

http://localhost/index.php/adminUrl

With:

http://127.0.0.1/index.php/adminUrl

4. Restart apache server

I hope it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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