Answer the question
In order to leave comments, you need to log in
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>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question