Ok I'm new to Laravel so went straight to the documentation to get started. There are massive holes in the documentation so it took a lot of effort and googling to fill the gaps in order to get Laravel set-up. I now have it set up and moved on to the next step in the quick start guide.I created my route
Route::get('users', function()
{
return 'Users!';
});
Now it says:
Now, if you hit the /users route in your web browser, you should see Users!
So I hit up:
http://localhost/laravel/users
but get a 404? I tried
http://localhost/laravel/public/users
but still a 404? I followed the steps on the quick start guide to the letter, what am I missing?
please refer to this follow url and see RoboTamer's config:
http://forums.laravel.io/viewtopic.php?id=511
it solved my problem the same as yours
solution in nginx:
server {
}
The problem is well explained by Rubens above, A simpler solution is to use the supplied built-in PHP Server by issuing this command
Note that I am using port 8080 here, you can omit it.Now you can browse the site by going to
and it should work!
Thanks. Knowledge of the above by @rubens, and a comment by @GaryJ here made me do this to make it work from my Apache virtual hosts file.
Copied these lines from .htaccess file in laravel within node of the vhosts config. Removed my .htaccess file (it was anyway not being applied, i am on a windows apache virtual host, laravel env)
Better: Later read @Ag0r0 's reply, that worked. i was missing the allow override, making the above neccessary. once allowoverride all was there, the default settings itself worked.
In my case (
Ubuntu 14.04 LTS & Apache 2.2
) I was stuck at #1 step of @Rubens' solution. I could see the page with this url:http://localhost/laravel/index.php/users
but step #2 and others didn't work.Also I've tried to add
RewriteBase /laravel/public
to.htaccess
but it didn't work too.Then I've set up a new virtual host with the help of this awesome tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts (they rock with these tuts)
In addition to tutorial, I've set
DocumentRoot
(inexample.com.conf
file) like this:Yes,
public
is the big deal here.Btw, don't put
RewriteBase /laravel/
to your.htacces
file otherwise you'll getHTTP/500
error.Now, I can see
example.com/users
page.my previous post with the describtion of the problem was deleted, but it was similar to the situation that is described here.
anyway... simply i have tried all the possibilities that are described here as well as on other pages and I did not find solution to my problem.
The fresh installation of the Laraval simply did not worked.... after trying everythink from this post i decided to create yet another fresh installation and miracle happened this installation is actually working...
So my advice is: if you are not able to fix this problem just try to create another installation of the laravel and it might actually work.
This might be actually the easiest way how to fix your problem in case you are starting from the scrach.
I had the same problem and spent hours to solve it. I have several apps under the same domain, but in different segments. So Laravel's url is
http://myhostname/mysubdir/
My controllers were only working as
http://myhostname/mysubdir/index.php/mycontroller
On /var/www/.../public/.htaccess I put
RewriteBase /mysubdir
and worked!!!