Laravel htaccess – public folder access

Spread the love

If your laravel application is installed at /public_html/laravel you will look inside /public_html/laravel/public and delete the .htaccess file there. Then inside the /public_html/laravel directory make a new file called .htaccess

Copy the code below to a new .htaccess file

 
    
        Options -MultiViews
    

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /public/$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ public/index.php [L]

Demo:

Download Links

Scroll to Top