General

Magento 2: Method to Fix 404 error “Page Not Found” issue in Admin URL

Hello Magento geeks,

In the last tutorial, we have learned How to Restrict Other Countries for Shipping in Magento 2,

Today, I am back again with a new tutorial, and this time I will explain to you how you can resolve 404 error-page not found for admin in Magento 2.

Magento is one of the leading eCommerce platforms used by many businesses worldwide. And if you also have chosen Magento for your Business, then you are on the right path. If you are new or an experienced person who has been using Magento 2, then you would know that you have to perform lots of tasks from the admin panel.

After you have set up the new Magento 2 store, there are chances you might face the issue of admin 404 error, or after any security or any third-party extension can cause your admin login page inaccessible with 404 error page.

In this tutorial, I am going to explain how you can resolve the 404 error-page not found with all the possible solutions in Magento 2 admin. Below is the list of solutions you can apply to your Magento 2 store.

   1. Flush and Clear Magento Cache by Command line or removing folders manually.

php bin/magento cache:clean

rm -rf var/cache/*

rm -rf var/generation/*

Or you can manually delete the cache and generate a folder inside a var folder from Cpanel.

    2. Enable Rewrite mode,

sudo a2enmod rewrite

Configure apache.

For Ubuntu / Debian edit the file /etc/apache2/apache2.conf. To edit this file run command

sudo vi /etc/apache2/apache2.conf

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>

Then restart apache

sudo service apache2 restart

or

sudo /etc/init.d/apache2 restart

or

sudo systemctl restart apache2

Then, if you’d like, you can use the following .htaccess file.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>

    3. htaccess file in the root

Try uploading default .htaccess file in the root of your Magento installation.

    4. Check the admin URL from the env.php file.

Go to app/etc/env.php open that file

And look for the admin URL, code must be like below

You can see/change admin URL from @app/etc/env.php

return array (
'backend' =>
array (
'frontName' => 'admin_q76xvk',
),

The highlighted one is the admin URL. Make sure you are typing the correct admin URL.

   5. For local environment sometimes URL issue like

During Setup you can replace the URL i.e., http://localhost/ with http://127.0.0.1/

  6. Try these steps

Delete var/cache folder
Go to database SELECT * FROM core_config_data WHERE path = 'web/seo/use_rewrites' and make it 0

Then enter URL in your browser domain.com/index.php/adminurl

You don’t have to perform all of the solutions described in this list, but instead, try one by one and see what works for your store. And when you find the right solution for your store, then let us know in the comment section below.

If you have any other solution apart from this list, then also you can comment below and let us know so that we can update this tutorial blog for other readers.

So, today, we learned that how you can resolve the 404 error-page not found for admin in Magento 2.  If you like what I am sharing, then give it a thumb-up and also share this with your Magento colleague and friends.

To learn more about Magento, I have exciting Magento tutorial series where I update regular blog articles, especially for readers like you, which you can check out at any time. And if you have anything in mind, and want me to write a blog on that too, then let me know in the comments below.

Lastly, if you need any help with your Magento store, then you can always contact our support center at any time, and we will be happy to help you ?

FAQ’s

(1) How to redirect 404 error page in Magento 2?

Answer: To redirect a 404 error page, head to Marketing > Advanced SEO Suite > Redirects, and add a redirect to any error 404 page. You can redirect visitors to your home page, or, if you’re redirecting manually, to a relevant category page.

(2) What is admin 404 Not Found?

Answer: The 404 error is an HTTP response code that occurs when the server cannot find the file or page requested by the user.

(3) How do I find my Magento 2 admin URL?

Answer: Default Base URL: http://yourdomain.com/magento/ Default Admin URL and Path: http://yourdomain.com/magento/admin.

(4) How do I fix 404 error in Magento?

Answer: This issue should be resolved by logging out and logging in to the Magento Administration Panel again.

(5) What is 404 error access log?

Answer: A 404 error is defined as a missing file or resource. Looking at the request URI will tell you which one it is. You can then check your deployment to make sure a file hasn’t accidentally been deleted or removed.

Click to rate this post!
[Total: 27 Average: 4.1]
Gaurav Jain

Gaurav Jain is Co-Founder and Adobe Certified Expert-Magento Commerce Business Practitioner. Being Computer Engineer?‍? and possessing Extensive Marketing skills he handles all kinds of customer Queries and his Happy? & Helping? Nature makes customer's day Delightful. When he isn’t working, you’ll find Gaurav Reading on Books? or Traveling?. Also, he is Speaker at Magento Meetups.

View Comments

  • Thanks a lot Sir, Solution 2 - 2. Enable Rewrite mode, This solution worked for me and I am happy now!! Thank You once again , Awesome Tutorial.

  • I have upgraded magento from 2.3.6-p1 to 2.4.2, and then I started getting 404 error on all pages, either front end or backend, tried all options above, confirmed that mod_rewrite is enabled on my apache, url I am using with IP instead of localhost, made file permissions to 777 (for files and folders to overcome file permissions issue), cleared all cache and generated contents, recompiled and deployed but nothing helped.

  • Hi,
    All the options or solutions mentioned in this page didnt work for me. I have installed Magento 2.4 using composer in ubuntu server. static content is loading fine but magento frontend or admin url is throwing 404 error: page not found. could you please help me.

    • Did you follow all the steps to install the Magento on Ubuntu server?
      Please confirm the file permissions.

Recent Posts

How to Add Tooltip in Checkout Shipping Field in Magento 2?

Hello Magento Friends, In today’s blog, I will explain How to Add Tooltip in Checkout…

2 days ago

How to Integrate and Use MongoDB with Laravel?

MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…

3 days ago

NodeJS | Callback Function

In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…

4 days ago

How to Show SKU in Order Summary in Magento 2?

Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…

6 days ago

Best Colors to Use for CTA Buttons

The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…

1 week ago

Magento 2: How to Save Custom Field Value to quote_address for Multi-Shipping Orders

Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…

1 week ago