Skip to content

Instantly share code, notes, and snippets.

@vool
Last active December 11, 2015 06:08
Show Gist options
  • Save vool/4556792 to your computer and use it in GitHub Desktop.
Save vool/4556792 to your computer and use it in GitHub Desktop.
.htaccess rules
#########################################
prevent script execution in directory
useful when access permissions and to be lax
IndexIgnore *
Options All -Indexes
# Secure directory by disabling script execution, add any extentions required
AddHandler cgi-script .php .php2 .php3 .php4 .php5 .php6 .php7 .php8 .pl .py .jsp .asp .htm .html .shtml .sh .cgi
Options -ExecCGI
# Don't show this file
<Files .htaccess>
order allow,deny
deny from all
</Files>
#########################################
www to non-www
#Requires RewriteEngine
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment