Occasionally, you may encounter a 404 error on your website. A 404 error means that the web server, Apache by default on cPanel servers, can not find the requested file. The error could happen for several reasons, from the file not actually existing in the specified path, or it could be due to invalid rewrite rules. To confirm whether a .htaccess file is involved in causing the 404 error, try renaming the .htaccess files in each directory up to the website's document root:
mv -vi /home/user/.htaccess{,.bak}
mv -vi /home/user/public_html/.htaccess{,.bak}
This can also be done through cPanel File Manager by enabling the "Show Hidden Files" option.
A lot of sites running WordPress may encounter this error due to missing rewrite rules. This can be corrected by simply adding the rules found on https://wordpress.org/support/article/htaccess/ to the .htaccess file in the document root of the domain in question.
For domains not running WordPress, you need to ensure that the file exists in the path you are accessing. If a domain (domain.tld in this example) has a document root of /home/user/public_html and you are getting a 404 when accessing domain.tld/images/monster_truck.jpg, the file must exist at /home/user/public_html/images/monster_truck.jpg.
The error can also happen when a user has a typo in the URL.
Comments
0 comments
Article is closed for comments.