V
V
vadimstroganov2015-03-03 02:06:43
Laravel
vadimstroganov, 2015-03-03 02:06:43

How to make routing work in laravel 5?

Hello!
I spent the whole day tormenting myself with the installation of Laravel 5. I could not solve the problem.
Installing Laravel:

composer create-project laravel/laravel --prefer-dist

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

I make .htaccess in the root directory so that it is transferred to the public folder:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

OK! Now when you go to /laravel everything is ok.
Initially, there are already prepared controllers, for example, WelcomeController.php I
register the route: I try to go to /laravel And nothing happens, just a blank white screen. And the greeting of Laravel 5 should have seemed. I tried to make my own controllers, it turns out the same way, I don’t understand what the problem is. .htaccess in the public directory is like this:
Route::get('/', '[email protected]');
<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 would be grateful for any help!

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
ajaxtelamonid, 2015-03-06
@ajaxtelamonid

Want to try Laravel? Make it a virtual domain and don't suffer. In the folder ( localhost/laravel ) it does not work out of the box, it is not easy to force, the result will be unsecured.

V
Vyacheslav Barsukov, 2015-03-03
@slavabars

Take away.
Options -MultiViews
On the storage folder and nested give write permissions to everyone who executes the code. Well, or 777 if only a test.

V
Vyacheslav Plisko, 2015-03-03
@AmdY

Well, /laravel is far from /. Either write a normal DOCUMENT_ROOT to the /public folder, or suffer with RewriteBase and what might come up with the paths.

M
Mokhirjon Naimov, 2015-03-09
@zvermafia

I think the first thing to do is:
sudo chmod -R 777 laravel

I
Ivan Brown, 2015-06-04
@ikodeak

If the installation is composer create-project laravel/laravel
then you need to go to laravel/public

D
Denis Denis, 2015-07-06
@golovewkin

I also do not understand what the salt is here. I have openserver. If you put it in the localhost / blog folder, suppose it will be installed, but it will work crookedly, I've been spinning .htacess all day. But if you put it as a virtual domain, it works. NICE.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question