My Routes are Returning a 404, How can I Fix Them?
On my Ubuntu LAMP installation, I solved this problem with the following 2 changes.
- Enable mod_rewrite on the apache server:
sudo a2enmod rewrite
. - Edit /etc/apache2/apache2.conf, changing the "AllowOverride" directive for the /var/www directory (which is my main document root):
AllowOverride All
Then restart the Apache server: service apache2 restart
Have you tried adding this to your routes file instead Route::get('user', "user@index")
?
The piece of text before the @
, user
in this case, will direct the page to the user controller and the piece of text after the @
, index
, will direct the script to the user
function public function get_index()
.
I see you're using $restful
, in which case you could set your Route
to Route::any('user', 'user@index')
. This will handle both POST
and GET
, instead of writing them both out separately.
Using WAMP click on wamp icon
->apache
->apache modules
->scroll
and check rewrite_module
.
Restart a LoadModule rewrite_module
Note: the server application restarts automatically for you once you enable "rewrite_module"
Have you tried to check if
http://localhost/mysite/public/index.php/user
was working? If so then make sure all your path's folders don't have any uppercase letters. I had the same situation and converting letters to lower case helped.