The 404 or Not Found error occurs when the user can communicate with the server but 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?
How to Resolve 404/Not Found Error
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 the 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, a 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 the Basic tab.
Increase your Memory Limit.
Click on Save Changes.
In Magento, this can be fixed from the backend (Magento admin) as well as from the 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 the Varnish cache and restart the Memcached service from Manage Services after making all the changes mentioned. Please check the websites in a new browser window.
That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.