In Laravel, a 404 error signifies that the server cannot find the requested resource.
Common reasons include misconfigured routing, missing file references, and permission issues. Incorrect or absent route definitions lead to unmatched URLs, triggering a 404 error.
Here, we will guide you to add those rules in case they don't exist.
Related Article
Laravel Error Overview
View Laravel Error Logs
Enable
IMPORTANT: Please be aware that Technical Support cannot provide support on this issue as it is out of scope (OOS). A third-party developer is strongly advised to assist with any troubleshooting of Laravel configurations.
- Log into the cPanel
- Navigate to the document root of the affected site
-
Edit the .htaccess file
TIP: If .htaccess is not present, show hidden files in File Manager. - Add the following to the top of the .htaccess file
<IfModule mod_rewrite.c>
TIP: If the 404 error only occurs on a few links and not all of them, then the database has likely become corrupted, the linked pages have been moved or deleted, or required files may be missing. In these situations, it's usually best to restore a backup.
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule> - Click on Save Changes
- Check the site to ensure the error was resolved
TIP: If the issue persists, try clearing your browser cache. On servers with NGINX caching, clear the NGINX cache as well.
Comments
0 comments
Article is closed for comments.