public path not getting removed in laravel subdirectory

  .htaccess, laravel, php

I have this .htaccess file in my root laravel folder, site is hosted in subfolder but url is like this :

https://maindomain/public/laravelsubdirectory

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    RewriteEngine On
     # Force SSL
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]
    RewriteCond %{REQUEST_URI} (.w+$) [NC]
    RewriteRule ^(.*)$ public/$1 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php
</IfModule>

# Authorization comment 
RewriteEngine On 
RewriteCond %{HTTP:Authorization} ^(.+)$ 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

I want to remove public from this url.

Any help will be highly appreciated.

Source: Laravel

Leave a Reply