Skip links

Remove public folder from Laravel Subfolder Installation via htaccess

Add the following code to the htaccess file and this will simply remove public from your laravel subfolder installation.

<IfModule mod_rewrite.c>
RewriteEngine On
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>

Related Post

Laravel Redirect HTTP to HTTPS via .htaccess

Leave a comment