Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Last active December 10, 2015 21:50
Show Gist options
  • Select an option

  • Save steveosoule/4497601 to your computer and use it in GitHub Desktop.

Select an option

Save steveosoule/4497601 to your computer and use it in GitHub Desktop.
Common .htaccess Settings
### SOURCE: http://stackoverflow.com/questions/6847649/htaccess-help-need-to-force-www-https-and-remove-index-php
### Force WWW:
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L] # include 's' here to force ssl in addition to www
### Force SSL:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]
Remove "index.php":
### Remove "index.php"
RewriteCond %{THE_REQUEST} /index.php HTTP
RewriteRule (.*)index.php$ /$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment