R
R
Roman Govorov2021-02-16 14:25:00
Apache HTTP Server
Roman Govorov, 2021-02-16 14:25:00

How to remove from url /public/ in laravel 8?

In my url, the site works as site.ru and as site.ru/public , how can I make it work only as site.ru ?

I implemented it as follows, renamed the file in the root server.php to index.php
And threw the .htaccess file from the public folder into the root:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>


Before this implementation, meaning without renaming the server.php file, I just wrote the following in the root of the .htaccess file:
RewriteEngine On
RewriteRule (.*) public/$1

But that the first option that the second one work the same...
How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Vorobyov, 2021-02-16
@RGameShow

Set DocumentRoot to /public

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question