◦ Comprehensive security
◦ 24/7 support
Magento Guide → Admin → 404 Not Found
How to fix: Magento 2 admin 404 not found
A 404 error on your Magento 2 admin page can be a headache—especially if it pops up after installing extensions or updating your store’s settings. The good news? It’s usually fixable with just a bit of troubleshooting.
Let’s walk through the most common causes and how to fix them.
Host Magento at full throttle.
Get secure, reliable Magento hosting so you can scale faster.
1. Check for an incorrect admin URL
The most common reason for a 404 error in the Magento backend is that the admin URL has changed or wasn’t set up correctly.
Check the env.php file
Magento stores your admin path in the app/etc/env.php file under the ‘frontName’ key. For example:
‘backend’ => [
‘frontName’ => ‘admin_abc123’
]
This means your admin URL would be something like https://yourdomain.com/admin_abc123.
Use the correct admin login format
Make sure you’re not trying to log in using the default /admin URL unless you’ve kept that path. Common formats include:
- https://yourdomain.com/admin_abc123
- https://yourdomain.com/index.php/admin_abc123 (for sites without URL rewrites)
Confirm custom URL settings in the database
Open phpMyAdmin or use MySQL to check the core_config_data table for these paths:
- admin/url/custom
- admin/url/use_custom
- web/unsecure/base_url
- web/secure/base_url
Make sure they match your site’s current domain and that no incorrect custom admin paths are set.
2. Clear Magento and browser cache
If your settings are correct but the error persists, your cache may be to blame.
Clear Magento cache via CLI
Use SSH to run:
php bin/magento cache:clean
php bin/magento cache:flush
Clear var folders manually
You can also manually delete cached data by removing the contents of these folders:
- var/cache/
- var/page_cache/
- generated/
Clear your browser cache
Open a private or incognito window, or clear your browser cache. Sometimes your browser will remember old redirects even after you’ve fixed the backend.
3. Check your web server configuration
Misconfigured server rules can block access to URLs, even if Magento is working fine behind the scenes.
Verify Apache .htaccess rules
Check that your .htaccess file exists in the root directory of your Magento installation. It should contain rewrite rules that handle pretty URLs and redirect to index.php.
Enable Apache mod_rewrite
Magento 2 relies on mod_rewrite. If it’s not enabled, rewrite rules in .htaccess won’t work. You can enable it with:
sudo a2enmod rewrite
sudo systemctl restart apache2
Check Nginx configuration
If you’re using Nginx, confirm your configuration includes rules to pass requests to index.php, especially for /admin paths. Look for or add:
location / {
try_files $uri $uri/ /index.php?$args;
}
Confirm document root is /pub
For security, Magento 2 should serve from the /pub directory. If your server is still pointing to the root directory instead of /pub, you may get 404 errors.
4. Fix database-level issues
Magento’s database contains routing and config information that can lead to 404 errors if corrupted or incomplete.
Check for blank entries in url_rewrite
Run this SQL query:
SELECT * FROM url_rewrite WHERE request_path=”;
Delete any entries that return. Blank paths can confuse Magento’s routing engine and cause 404s on both frontend and backend URLs.
Double-check core_config_data entries
Incorrect or duplicated values under web/secure/base_url or admin/url/custom can break the admin link. Make sure they reflect your current domain setup and aren’t conflicting with each other.
5. Disable recently installed extensions
If the error started right after installing a new extension, that extension may be hijacking or breaking the routing.
Disable via CLI
Use the following commands to disable it:
php bin/magento module:disable Vendor_ExtensionName
php bin/magento setup:upgrade
php bin/magento cache:flush
Manually rename module folders
If CLI access doesn’t work or the module isn’t listed, go to app/code/ (for custom modules) or vendor/ (for marketplace modules) and temporarily rename the folder. Then flush cache and try again.
6. Check user role and file permissions
Your admin user account may be locked out or restricted from accessing the backend.
Review admin user roles
If you can log in from another admin account, make sure the affected account has the right role and permissions. Otherwise, use CLI to reset them or create a new admin user.
Reset file and folder permissions
Incorrect file permissions can prevent Magento from loading properly. Reset them with:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
Also make sure your files are owned by the correct user and group (usually www-data or apache).
7. Recompile and deploy static content (if needed)
After major configuration changes or module updates, it’s a good idea to recompile Magento and regenerate frontend/backend static assets.
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
This ensures that the admin panel can load all required CSS and JavaScript assets.
8. Restore from backup if changes broke the admin
If none of the fixes work and the problem started after a major change, it might be fastest to restore from a known-good backup.
Restore a file backup
If you edited env.php, .htaccess, or any other system file, replace them with a copy from before the error.
Restore a database snapshot
If you have a recent database backup from before the issue began, restoring it can fix broken routes, user roles, and admin URL settings in one go.
Magento 2 admin 404 FAQ
Next steps for fixing Magento 2 admin 404 errors
Fixing a Magento 2 admin 404 error often comes down to finding the weak link—whether that’s a mistyped URL, outdated cache, broken database entry, or server misconfiguration.
If you’ve gone through these fixes and still can’t access the admin, it may be time to bring in a Magento specialist or contact your hosting provider.
Ready to upgrade your Magento experience? Professional hosting improves speeds, security, and reliability for a website and a brand that people find engaging and trustworthy.
Liquid Web offers the raw infrastructure power you need with mission-critical features that keep your store running smoothly. Most importantly, our in-house Magento experts are standing by to help with both hosting and Magento application roadblocks.
Click through below to explore all of our Magento hosting options, or chat with an expert right now to get answers and advice.
Ready to get started?
Get the fastest, most secure Magento hosting on the market
Additional resources
What is Magento Ecommerce? →
A complete beginner’s guide to the Magento Ecommerce platform
Magneto vs. WordPress →
Compare pricing, hosting, security, SEO, and a lot more
Best Magento ERP extensions →
Our top 10 compared so you can decide which is best for your business