############################################



## use URL encoding in the http:// part





    RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http%3A%2F%2F [OR]



############################################



## Adding the following directive should give you an additional layer of security 

## against this type of attacks using the proc/self/environ method.





 RewriteCond %{QUERY_STRING} proc\/self\/environ [NC,OR] 







############################################



# PASS THE DEFAULT CHARACTER SET



############################################





AddDefaultCharset utf-8







############################################



# DISABLE THE SERVER SIGNATURE



############################################







ServerSignature Off







################################



# Disable directory browsing



################################

Options -Indexes

Options +FollowSymLinks

RewriteEngine on

IndexIgnore *







################################



# PROTECT .htaccess and .htpasswd FILES



################################



<FilesMatch "^\.ht">

  Order allow,deny

  Deny from all

  Satisfy all

</FilesMatch>







################################



# PREVENT FILE VIEWING WITH HTACCESS



################################



<Files ~ "\.(pl|jsp|php3|php4|php5|cgi|py|sh|cgi|php5|php|cgi|zip|gz|tar)$">

  order deny,allow

  deny from all

</Files>







################################



# PPROTECT CONFIG.* FILES



################################



<FilesMatch "^(.*)\.(inc|config\.php|tpl\.php|sql|dat|exe|dll|pl|cgi|jsp|asp|aspx|sh|php|cgi|zip|gz|tar|phtml)$">



  AddDefaultCharset UTF-8

  Order deny,allow

  Deny from all



</FilesMatch>





############################################



# DISABLING EXECUTING OF FOLLOWING FILES.



############################################



AddHandler cgi-script .php3 .php4  .pl .py .jsp .asp .sh .cgi .pl .jsp .aspx .php .cgi .zip .gz .tar .phtml







############################################



## workaround for HTTP authorization



## in CGI environment





    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]