For several reasons, webpage or pages of your Magento website may show 404 errors. The 404 error essentially indicates, the webpage with the URL put does not exist or is broken. That is to say, this 404 error is an error code of generic HTTP. It means that the webpage the user requested for, server cannot find that webpage.

There are some reasons that may cause this error. To fix the error, we need to solve according to the cause behind it. This blog will help you in fixing the error. So, let’s know the causes behind it and learn the steps to solve the error.

Error due to database inconsistencies
When the site owners import their databases to a new server, the ideal values of website_id and store_id - ‘zero’ for admin changes. To get rid of this error, use the command below in order to update website_id into 0 in table- core_website.

Code:
UPDATE ‘core_website’ SET website_id=0 WHERE code=’admin’;
After updating, refresh the cache for Magento: System> Cache Management

For clearing the cache settings for Magento, remove the file- use_cache.ser in the etc/app directory.

Error due to mod_rewrite module being disabled
This error can occur at the time of new installation of Magento.

To fix this error, firstly, check whether module- mod_rewrite is enabled. If not, enable the module & restart the server. To enable the module, uncomment this line.

LoadModule rewrite_module Libexec/apache2/mod_rewrite.so

To enable rewrite mode, give the following command:

Code:
Sudo a2enmod rewrite
You have to edit the file /etc/apache2/apache2.conf. for or Ubuntu/Debian. Run this command to edit the file:

Code:
Sudo vi /etc/apache2/apache2.conf
Modify it from here:

Code:
<Directory/var/www/>
Options Indexes FollowSymlinks
AllowOverride None
Require all granted
</Directory>
And to here:

Code:
<Directory/var/www/>
Options Indexes FollowSymlinks
AllowOverride All
Require all granted
</Directory>
Now, restart Apache:

Code:
sudo service apache2 restart
or

Code:
sudo /etc/init.d/apache2 restart
or

Code:
sudo systemctl restart apache2
You can even use this following .htaccess file, if you like:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Error due to custom admin URL
When users change the admin URL to a custom URL, but forget to set the url settings properly, this problem occurs. To fix this error, verify and correct the admin URL for Magento in core_config_data table.

  • admin/url/use_custom
  • admin/url/custom
  • web/secure/base_url
  • web/unsecure/base_url
And after that, remove all the caches from var/cache folder. You can change/see admin URL from @app/etc/env.php

Code:
Return array (
‘backend’
array (
‘frontName’ ‘admin_q76xvk’,
),
Error due to corrupted .htaccess file
The site owners may sometime accidentally modify or delete the .htaccess file. As a result, a 404 error shows.

To fix this error, check for any issues in the .htaccess file. If you find something, correct that mis-configuration in .htaccess file. Also, if you find the .htaccess file missing, download a new file and upload the file to root folder.

Error due to Magento cache
If the site owners forget clearing caches after applying the security patches, upgrading or installing an extension, this error might occur.

To fix this, clear Magento caches from the command line. Give this command:

Code:
php bin/magento cache:clean
rm –rf var/cache/*
rm –rf var/generation/*
It will clear the caches and your Magento will start to show updated contents.

As you have seen, Magento admin URL showing the 404 error is for some reasons. We have discussed the main reasons behind the 404 error. Also, we have shared the steps to fix these causes and thus the error. Hopefully, next time when you face this error, you will get thorough help from this blog.
Author
bhawanisingh
Views
3,428
First release
Last update
Rating
0.00 star(s) 0 ratings
Top