How to remove the public folder from URL with Laravel and PHP?

Spread the love

Sometimes, we want to remove the public folder from URL with Laravel and PHP.

In this article, we’ll look at how to remove the public folder from URL with Laravel and PHP.

How to remove the public folder from URL with Laravel and PHP?

To remove the public folder from URL with Laravel and PHP, we can add a few settings into the .htaccess file.

For instance, we write

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]

to rewrite all base URLs top the /public folder.

Leave a Reply

Your email address will not be published. Required fields are marked *