Skip to content

Instantly share code, notes, and snippets.

@prodhan
Created January 12, 2021 07:00
Show Gist options
  • Save prodhan/b8385c8b7930216ce872fd583a5f861d to your computer and use it in GitHub Desktop.
Save prodhan/b8385c8b7930216ce872fd583a5f861d to your computer and use it in GitHub Desktop.
htaccess to remove /public from Laravel
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteCond %{HTTP:Authorization} .+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment