I ussualy using Laravel 4 and now Im trying to learn Laravel 5
there's problem on Naming Controller Routes :
i had route like :
Route::get('/', [
'uses' => 'HomeController@viewHome',
'as' => 'home'
]);
Route::get('/events', [
'uses' => 'EventController@viewEvent',
'as' => 'event'
]);
when i run route as 'home' (localhost/laravel/) its work perfectly
but when i run route as 'event' (localhost/laravel/events): Object not found!
and i already make sure that viewEvent method running right by swap it like this:
Route::get('/', [
'uses' => 'EventController@viewEvent',
'as' => 'home'
]);
Route::get('/events', [
'uses' => 'HomeController@viewHome',
'as' => 'event'
]);
i can run viewEvent but i cant run viewHome
any problem with my code?
======================== SOLVED =============================
with help @DamienPirzy and i realize when i disable /public/ folder i think i must make .htaccess out to main folder too :)
thanks all for fast response :) Problem Solved
Put this htaccess into public folder. make sure you have apache mod rewrite working.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
i saw in routes.php
Route::get('/events', [
'uses' => 'EventController@viewEvent',
'as' => 'event'
]);
But u run
localhost/laravel/event
Should run
localhost/laravel/events
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