T
T
t0nsofdamage2017-10-05 17:43:48
htaccess
t0nsofdamage, 2017-10-05 17:43:48

How to make a correct redirect to Laravel 5.5 in public?

The redirect is already working i.e. if we write: site.ru/about
everything works correctly.
However, if you write in the address bar: the site.ru/public/about
desired page will also be displayed and the links in the main navigation will change to:
site.ru/public/home
site.ru/public/products
Links in the navigation menu are formed in this way:

<li><a href="{{ route('about') }}">О компании</a></li>

htaccess at the root looks like this:
RewriteEngine on

RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

Tell me, please, how to deal with this public once and for all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-10-06
@t0nsofdamage

This is a very popular problem when setting up a project, for some reason everyone always directs their server to the root directory,
although in frames they almost always make the web directory a separate folder, hence the questions ... in Lara it's a folder public, in Yii2 it's a folder web
Customize it is possible, but when they begin to complicate the application - footcloths of configs with problems climb.
There is only one correct solution - to direct the server to the folder with the index.php file, that is, for the web server, the root will be in your folderpublic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question