Skip to content

Instantly share code, notes, and snippets.

@wp-kitten
Created April 24, 2020 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wp-kitten/627257365e135d2cf83012331b138bd6 to your computer and use it in GitHub Desktop.
Save wp-kitten/627257365e135d2cf83012331b138bd6 to your computer and use it in GitHub Desktop.
Localhost Laravel app htaccess
#
# Local .htaccess file
# Used to set the "public" directory as the document root
### laravel App (https://laravel-site.dev/)
#
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{DOCUMENT_ROOT}/public/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/public/$1 -d [OR]
RewriteCond %{DOCUMENT_ROOT}/public/$1 -l
# Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.
RewriteRule (?!^public/)^(.*)$ /public/$1 [R=302,L,NC]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment