I installed Laravel 4 using Composer and also set up a virtual host. Currently, only the root route is working:
<?php Route::get('/', function() { return View::make('hello'); });
This is not:
Route::get('/hello', function() { return View::make('hello'); });
What I'm trying to hit is TasksController
at /tasks
:
Route::resource('tasks', 'TasksController');
This is giving me 404 error as well. What could I be doing wrong? I have a default .htaccess file at the root of my project:
<IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>
I am using localhost on a Mac.
It should be enough to just run php artisan vendor:publish --tag=laravel-errors and then edit the newly created resources/views/errors/404.
Error 404 is a client-side issue indicating the requested URL can't be found on the server. It may occur because of several reasons, such as the domain is not pointed correctly, a broken . htaccess file, or misconfigured file permissions.
In your Laravel project folder, create a folder called “errors” in your /resources/views/ folder. Create a file called 404. blade. php in this /resources/views/errors/ folder.
Create Custom 404 Error Page You need to create blade views for error pages, move to this path resources/views/ inside here create errors folder and within the directory create 404. blade. php file. It will redirect you to the 404 page if you don't find the associated URL.
Just for a laugh, see if /index.php/hello
works.
If so, then most likely it's a .htaccess
problem.
Had the same problem running Laravel 4 on WAMP (Windows 8).
The solution that worked for me was:
Open apache httpd.conf and find this line :
#LoadModule rewrite_module modules/mod_rewrite.so
#
)httpd.conf
It should be working!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With