Bobcares

Magento admin URL shows 404 error – Steps to handle this error

by | Dec 28, 2018

Today when I log in, my Magento admin URL shows a 404 error page. Please fix this.

That was a recent support ticket received at out Server Support department where we resolve support queries for web hosts.

Magento store owners face this error after installing or upgrading extensions, migrating websites, installing security patches, etc.

Today we’ll discuss the top 5 reasons for this error and how our Server Support Engineers fix it.

 

What is a 404 Error?

Simply put, 404 error means that the webpage doesn’t exist with the entered URL.

In other words, this is a generic HTTP error code, which indicates that the server can’t find the webpage requested by the user.

 

magento admin url 404

How 404 error looks like?

 

This means that either the page has been removed or broken.

 

Magento admin URL shows 404 error – Causes and Solutions

Based on our experience with Magento websites, we found a number of causes that turned out to be the culprit behind this error.

So, firstly we check the Magento logs such as exception.log and system.log and PHP error logs to find out where the problem originates.

Let’s now see why Magento admin URL shows 404 error and how our Support Engineers fix it.

 

1) Database inconsistencies

Ideally, in a Magento database, the store_id and website_id values for admin should be set to 0 (zero).

But, these values can change when store owners import the database to the new server, and users see 404 errors in Magento admin login page.

 

How we fix?

In this case, our Support Engineers  correct the store_id and website_id for admin to 0 in the Magento database.

For example, we use the below command to update the website_id to 0 in the core_website table.

UPDATE 'core_website' SET website_id =0 WHERE code='admin';

 

Most importantly, we always backup the database before making any changes as a security measure.

After that, we refresh the Magento cache from System > Cache Management.

Alternatively, we remove the use_cache.ser file in the app/etc directory to clear the Magento cache settings.

 

2) Corrupted .htaccess file

Similarly, another common reason for this error is corrupted/missing .htaccess file.

The .htaccess file in Magento contains rewrite rules for the Magento site and associated links to work fine.

But, it can happen this file got accidentally deleted or modified by the website owners.

As a result, these rules no longer work and can result in 404 errors in Magento admin login page.

 

How we fix?

Our Support Engineers first check whether the .htaccess file is the actual culprit by temporarily renaming this file.

If any issues are noted, we will correct the misconfiguration in the .htaccess file.

And, if we find .htaccess file is missing, we download a fresh .htaccess file for the Magento application and upload it to the root folder.

[Messed up .htaccess rules in your website? Don’t worry, our Support experts are here to help you.]

3) mod_rewrite module disabled

Likewise, this problem can happen during fresh Magento installation.

Sometimes, the hosting server doesn’t support mod_rewrite module, and as a result users see 404 errors.

 

How we fix?

Our Support Specialists first check whether the mod_rewrite module is enabled on the server by checking the web server configuration file.

If it’s not enabled, we enable it and restart the web server to make the changes into effect.

For example, we uncomment the following line to enable mod_rewrite module in Apache web server.

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

 

In addition to that, we add the following code to the Apache configuration.

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

 

This allows any directives to be placed in the website user’s .htaccess file.

But, we always make sure to backup the Apache configuration file before making any changes, so if anything goes wrong, we can restore it back.

[And, do you want to enable this module on your server? Our Server Administration team can do this for you in minutes.]

 

4) Magento cache

Sometimes, Magento cache may also cause problems.

This happens mainly when store owners forget to clear the cache after applying security patches, installing or upgrading an extension.

As a result, the Magento admin panel shows old data.

 

How we fix?

Here, our Hosting Engineers clear the Magento cache from command line.

php bin/magento cache:clean
rm -rf var/cache/*
rm -rf var/generation/*

 

This clears the cache files and Magento starts showing the updated contents.

 

5) Custom admin URL

The default URL of Magento admin is “http://yourdomain.com/magento/admin“.

But, store owners have the privilege to customize it.

However, users run into problems, when changing the admin URL to a custom one, but don’t set the custom_admin_url settings properly.

How we fix?

In such cases, our Support Engineers will verify and correct the Magento admin URL in the following fields of core_config_data table.

  • admin/url/use_custom
  • admin/url/custom
  • web/secure/base_url
  • web/unsecure/base_url

 

Finally, we remove all cache files from var/cache folder.

Conclusion

In short, Magento admin URL shows 404 error due to database inconsistencies, cache issues, and more. Today, we’ve discussed the top 5 reasons for this error and how our Server Support Engineers fix it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Ben Parish

    In my case, I had accidentally set a store as the default in the control panel.

    In core_config_data:

    layout_switcher/general/default_theme was set to ‘interiors’

    Whenever I tried to access the admin area, I got the template for ‘interiors’ and a 404. To fix I set:

    layout_switcher/general/default_theme back to ‘base’

    I then ran:

    php bin/magento cache:clean
    php bin/magento cache:flush

    Reply
    • Visakh S

      Thanks for the tip Ben. 🙂

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF