Skip to content

Instantly share code, notes, and snippets.

@jjsquady
Created July 7, 2016 01:15
Show Gist options
  • Save jjsquady/e914583ee49a2ca4de30a14c5a739874 to your computer and use it in GitHub Desktop.
Save jjsquady/e914583ee49a2ca4de30a14c5a739874 to your computer and use it in GitHub Desktop.
Arquivo .htaccess para hospedagem compartilhada (Laravel)
RewriteEngine On
RewriteBase /
# Rewrite to pulic
RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
# Redirect www to domain
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Deny access to framework directories
RewriteRule ^(app|bootstrap|config|database|resources|storage|tests|vendor|node_modules)/ - [R=404,L,NC]
# And dot files/folders (for example .env)
RedirectMatch 404 /\..*$
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment