In this KB:
- What is the 404/Not Found error and why does it occur?
- How to fix the 404 error
- Step to perform after fixes are applied
The 404 or Not Found error occurs when the user can communicate with the server, but it is unable to locate the requested file or resource. The error may occur for a wide variety of reasons. Some general troubleshooting questions to ask are:
- Did the user type in the wrong URL?
- Does the file exist in the correct location on the server? Was the resource moved or deleted on the server?
- Does the server configuration have the correct document root location?
Sometimes when a site is manually migrated, the old .htaccess may not have migrated, as it is a hidden file. This results in the usage of default .htaccess file. Therefore, it is required to check the code of your .htaccess file. Make sure that mod_rewrite is enabled in the .htaccess file.
Apart from this, 404 error can also occur due to permission issues on the file. To fix the permission issue, you can reset the permissions by following this guide.
In other cases, the not found error is also caused by using plugins. This can be checked by reading error logs via SSH/SFTP and deactivating the plugin responsible for this.
Similarly, themes with missing CSS or JS files can also cause 404 errors.
404 error may sometimes be caused due to PHP memory limit exhaustion, in which case you can increase memory limits from the Server Settings and Packages section under the Server Management area in the Cloudways Platform.
- Click on Settings & Packages.
- Select Basic tab
- Increase your Memory Limit
- Click on Save Changes
In Magento, this can be fixed from the backend (Magento admin) as well from System drop-down menu. Go to Index Management and click on Select All and then select Reindex Data. Finally, click on the Submit button. Alternatively, this can be done by executing the Magento indexer cron.
- It is also advised to purge Varnish cache and restart Memcached service from Manage Services after making all the changes mentioned. Please check the websites in a new browser window.