Skip to content

Instantly share code, notes, and snippets.

@levidurfee
Last active February 21, 2018 00:05
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 levidurfee/a8be3448cb35f6cb99de4bbbe8eef6fb to your computer and use it in GitHub Desktop.
Save levidurfee/a8be3448cb35f6cb99de4bbbe8eef6fb to your computer and use it in GitHub Desktop.
htaccess
allow from all
deny from 1.2.3.4 # blocks one IP address
deny from 1.3 # blocks every IP beginning with 1.3
RewriteEngine On
RewriteBase /
# Removes index.php
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# If 404s, "No Input File" or every URL returns the same thing
# make it /index.php?/$1 above (add the question mark)
# Redirect domain.com to www.domain.com
RewriteCond %{HTTP_HOST} !^www\.DOMAIN\.com$
RewriteRule (.*) http://www.DOMAIN.com/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment