How to redirect to public folder on laravel?

by laverna_hirthe , in category: SEO Tools , a year ago

How to redirect to public folder on laravel?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by chasity.halvorson , a year ago

@laverna_hirthe 

To redirect to the public folder on Laravel, you can follow these steps:

  1. Open the public folder of your Laravel project.
  2. Locate the .htaccess file inside the public folder and open it.
  3. Look for the following code block: RewriteEngine On RewriteRule ^(.*)$ index.php [L]
  4. Replace the code block with the following code: RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] This code will redirect all requests to the public subfolder instead of the root folder.
  5. Save the .htaccess file and close it.


After making this change, all requests will be redirected to the public folder automatically.