How to get to work routing in laravel 5?


The whole day I toiled with the installation of Laravel 5. Was not able to solve the problem.

Install Laravel:
composer create-project laravel/laravel --prefer-dist

OK! Try to go to /laravel
You don't have permission to access /laravel/ on this server.

Do .htaccess in root directory location so he tossed into the public folder:
<ifmodule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_URI} !^public
 RewriteRule ^(.*)$ public/$1 [L]

OK! Now when entering /laravel everything is OK.

Initially there have already harvested controllers, for example WelcomeController.php

Prescribed route:
Route::get('/', 'WelcomeController@index');

Try to go to /laravel
And nothing happens, just blank white screen. And it should seem greeting Laravel 5.
I tried to do your controllers, just as it turns out, I do not understand what the problem is.

.htaccess in the public directory location is:
<ifmodule mod_rewrite.c>
 <ifmodule mod_negotiation.c>

 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]

I would be grateful for any help!
September 19th 19 at 00:06
6 answers
September 19th 19 at 00:08
Want to try Laravel ? Make him a virtual domain and do not suffer. In the folder (localhost/laravel) it does not work out of the box, get hard, the result will be nesecary.
Why is not working? what is tied? - Selmer commented on September 19th 19 at 00:11
Also not clear, I larval this twist as you want, on what you want the domains, ip, localhost, all works without problems. White screen can be due to many things that have nothing to do with the url. This may not be true right, so as the user under which the server is running and the user under which runs the composer most likely different. May be missing php lib, php itself may not be the version (5.3 for example). - omer90 commented on September 19th 19 at 00:14
Agree with . Do not put laravel in a folder. Do as in the documentation. Deploy laravel in the root of localhost or create a different virtual domain. After create 2 httacces to redirect to public, and the second in the public folder - all should work. If it doesn't - see logs of apache and php. Most likely have to go through the folders chmod 777-R - roy3 commented on September 19th 19 at 00:17
September 19th 19 at 00:10


On the storage folder and sub-give write permission to everyone who takes the code. Well, or 777 if only the test.
Gave strorage 777, it helped, everything works as it should. As I understand it, the 777 is desirable not to leave? - Selmer commented on September 19th 19 at 00:13
September 19th 19 at 00:12
Well /laravel this is not /. Or list the normal DOCUMENT_ROOT to /public, or suffer with RewriteBase and what ways can swim.
I literally said - Selmer commented on September 19th 19 at 00:15
September 19th 19 at 00:14
I think for the beginning it is necessary to do so:
sudo chmod-R 777 laravel
Bad advice. Do you only need 777 on the storage folder. - Selmer commented on September 19th 19 at 00:17
September 19th 19 at 00:16
If you are installing composer create-project laravel/laravel
you need to go to laravel/public
September 19th 19 at 00:18
I do not understand what the salt is. I have OpenServer. If you put in the folder localhost/blog will assume it is installed, but the work is crooked, the whole day spinning .htacess. But if you put the virtual domain is working. EMPTY.

Find more questions by tags PHPLaravel