Skip to content

Instantly share code, notes, and snippets.

@m5lil
Created July 12, 2020 16:18
Show Gist options
  • Save m5lil/d6db8acbca37b0aa4488266caef8828a to your computer and use it in GitHub Desktop.
Save m5lil/d6db8acbca37b0aa4488266caef8828a to your computer and use it in GitHub Desktop.
some practices for htaccess
#  any 2 letter/anything from 1 word (kebab-case)/any level from directory/../..
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[a-z]{2}((\/(\w+)(-?(\w)([\w-]*))?)+)?$ "public/index.php" [L]
# Laravel Images to work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^img\/(.*\.(gif|jpg|png))$ public/img/$1 [QSA,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment