Laravel4 : The requested resource /admin was not found on this server

Laravel4 : The requested resource /admin was not found on this server

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Laravel4 : The requested resource /admin was not found on this server

If you are running a local Laravel development environment using php artisan serve and encounter a "Route Not Found" exception specifically for the /admin path while other routes work perfectly, the issue almost certainly isn't with your routing definitions. It is almost certainly a naming conflict within the web server's URL rewriting layer.

This specific behavior in Laravel 4 often stems from how the .htaccess file interacts with the public directory. When you install Laravel using Composer or download the package directly, the framework includes an .htaccess file designed to handle routing for Apache servers. However, on Windows systems (where php artisan serve runs), this file is often copied over verbatim by default, even though it may contain directives that confuse the underlying PHP built-in server or clash with environment variables.

The root cause here is almost always a case-sensitivity mismatch in the rewrite rules defined in the .htaccess file. If you look closely at the configuration provided by older Laravel versions (or specifically the one included in the public folder), you might find rules that explicitly check for Admin, admin, or specific paths. In some configurations, particularly if a custom .htaccess was manually created to route /admin to a specific controller, the rule might be written as:

RewriteRule ^admin/?$ [L]

While this looks correct, the real culprit in this "weird problem" is often how the public directory structure interacts with the rewrite engine when serving from the root. If your .htaccess file contains a line that forces a specific casing or redirects based on a string match that fails silently for /admin but works for /dashboard, it suggests the regex isn't matching as expected.

However, in the context of php artisan serve, the most common reason for this specific "name collision" is that the .htaccess file itself contains a rule that attempts to rewrite /admin to an internal script that doesn't exist, or it conflicts with a global variable named $admin.

To resolve this without reinstalling your application, you should inspect the .htaccess file located in the public directory. If you find any custom rewriting rules targeting the word "admin," comment them out temporarily to see if the route resolves correctly.

If you are using the default Laravel 4 setup, ensure that the .htaccess file does not contain a rule like:

RewriteRule ^admin$ /index.php/admin [L]

Unless you have explicitly configured a controller or closure named admin at that exact path, this will cause a 404. The Laravel router expects requests to hit /public/index.php (or just /index.php depending on your alias setup), but if the .htaccess is rewriting the request before it reaches the framework's router, and the target doesn't exist, you get the exception shown in your error screenshot.

The solution is to ensure that the .htaccess file only contains the standard Laravel directives necessary for Apache. For php artisan serve, you actually do not need a complex .htaccess file at all if you are not using Apache. You can safely remove or disable the .htaccess file in the public directory while running the built-in server. This forces all requests to be handled directly by the Laravel dispatcher, bypassing any conflicting rewrite rules that might treat /admin as a static resource or fail to pass it to the router.

After removing or commenting out the problematic .htaccess file, clear your route cache with:

php artisan route:clear

Then try accessing http://localhost/admin again. If the route is defined in your routes.php, it should now load correctly because the request is reaching the router without interference from a broken rewrite rule.

If you need to keep the .htaccess file for other reasons, ensure that no global redirect rules are forcing specific casing on the URL path. The trade-off here is that removing .htaccess means you lose protection against directory browsing and static asset optimization if you were relying on those rules, but for local development with php artisan serve, simplicity and direct routing are preferred to avoid these exact kinds of naming conflicts.

Our network