Skip to content

Instantly share code, notes, and snippets.

@toledox82
Last active February 16, 2018 23:38
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 toledox82/c9234f60c763a543fc08 to your computer and use it in GitHub Desktop.
Save toledox82/c9234f60c763a543fc08 to your computer and use it in GitHub Desktop.
My default .htaccess
RewriteEngine On
# RewriteBase /
# Force SSL and Non-WWW for main domain (except local)
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com\.br$ [NC]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://domain.com.br%{REQUEST_URI} [R=301,L,NE]
### Remove .php
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME}\.php -f
# RewriteRule ^(.*)$ $1.php
# RewriteRule ^index\.php$ / [R]
### Error Pages
# ErrorDocument 404 /404.html
### File Access
Options -Indexes
### Redirects
# Redirect /path http://site.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment