Skip to content

Instantly share code, notes, and snippets.

@wp-kitten
Created January 3, 2023 21:10
Show Gist options
  • Save wp-kitten/ff5164df5caecf8640047a3ae981fa94 to your computer and use it in GitHub Desktop.
Save wp-kitten/ff5164df5caecf8640047a3ae981fa94 to your computer and use it in GitHub Desktop.
Remove "public" from URL for Laravel websites
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
---
This will silently rewrite all your base URIs to the /public folder.
Even all Headers, for example the HTTP Authorization Header, and all
optional URI parameters will silently be passed on to the /public folder as well.
Applies to web hosts that do not allow to change the home directory.
Location: .htaccess file in the root directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment