# так безопаснее
php_value register_globals 0 
# убираем экранирование кавычек 
php_value magic_quotes_gpc 0 
# дописываем сессию к URL 
php_value session.use_trans_sid 1 
php_value session.cookie_lifetime 0
# кодировка по-умолчанию
AddDefaultCharset UTF-8
<Files count.php>
order allow,deny
deny from all
</Files>
RewriteEngine On
RewriteRule ^$ /software/ [R=301,L]
# RewriteEngine
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^id([0-9]*) /account/?id=$1 [L,QSA]
</IfModule>
# ESSENTIALS
RewriteEngine on
ServerSignature Off
Options All -Indexes
Options +FollowSymLinks
# FILTER REQUEST METHODS
<IfModule mod_rewrite.c>
 RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK) [NC]
 RewriteRule ^(.*)$ - [F,L]
</IfModule>
# BLACKLIST CANDIDATES
<Limit GET POST PUT>
 Order Allow,Deny
 Allow from all
</Limit>
# QUERY STRING EXPLOITS
<IfModule mod_rewrite.c>
 RewriteCond %{QUERY_STRING} \.\.\/    [NC,OR]
 RewriteCond %{QUERY_STRING} boot\.ini [NC,OR]
 RewriteCond %{QUERY_STRING} tag\=     [NC,OR]
 RewriteCond %{QUERY_STRING} ftp\:     [NC,OR]
 RewriteCond %{QUERY_STRING} http\:    [NC,OR]
 RewriteCond %{QUERY_STRING} https\:   [NC,OR]
 RewriteCond %{QUERY_STRING} mosConfig [NC,OR]
 RewriteCond %{QUERY_STRING} ^.*(\[|\]|\(|\)|<|>|'|"|;|\*).* [NC,OR]
 RewriteCond %{QUERY_STRING} ^.*(%22|%3C|%3E|%5C|%7B|%7C).* [NC,OR]
 RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F|127\.0).* [NC,OR]
 RewriteCond %{QUERY_STRING} ^.*(globals|encode|config|localhost|loopback).* [NC,OR]
 RewriteCond %{QUERY_STRING} ^.*(request|select|insert|union|declare|drop).* [NC]
 RewriteRule ^(.*)$ - [F,L]
</IfModule>
# CHARACTER STRINGS
<IfModule mod_alias.c>
 # BASIC CHARACTERS
 RedirectMatch 403 \,
 RedirectMatch 403 \:
 RedirectMatch 403 \;
 RedirectMatch 403 \=
 RedirectMatch 403 \@
 RedirectMatch 403 \[
 RedirectMatch 403 \]
 RedirectMatch 403 \^
 RedirectMatch 403 \`
 RedirectMatch 403 \{
 RedirectMatch 403 \}
 RedirectMatch 403 \~
 RedirectMatch 403 \"
 RedirectMatch 403 \$
 RedirectMatch 403 \<
 RedirectMatch 403 \>
 RedirectMatch 403 \|
 RedirectMatch 403 \.\.
 RedirectMatch 403 \/\/
 RedirectMatch 403 \%0
 RedirectMatch 403 \%A
 RedirectMatch 403 \%B
 RedirectMatch 403 \%C
 RedirectMatch 403 \%D
 RedirectMatch 403 \%E
 RedirectMatch 403 \%F
 RedirectMatch 403 \%22
 RedirectMatch 403 \%27
 RedirectMatch 403 \%28
 RedirectMatch 403 \%29
 RedirectMatch 403 \%3C
 RedirectMatch 403 \%3E
 RedirectMatch 403 \%3F
 RedirectMatch 403 \%5B
 RedirectMatch 403 \%5C
 RedirectMatch 403 \%5D
 RedirectMatch 403 \%7B
 RedirectMatch 403 \%7C
 RedirectMatch 403 \%7D
 # COMMON PATTERNS
 Redirectmatch 403 \_vpi
 RedirectMatch 403 \.inc
 Redirectmatch 403 xAou6
 Redirectmatch 403 db\_name
 Redirectmatch 403 select\(
 Redirectmatch 403 convert\(
 Redirectmatch 403 \/query\/
 RedirectMatch 403 ImpEvData
 Redirectmatch 403 \.XMLHTTP
 Redirectmatch 403 proxydeny
 RedirectMatch 403 function\.
 Redirectmatch 403 remoteFile
 Redirectmatch 403 servername
 Redirectmatch 403 \&rptmode\=
 Redirectmatch 403 sys\_cpanel
 RedirectMatch 403 db\_connect
 RedirectMatch 403 doeditconfig
 RedirectMatch 403 check\_proxy
 Redirectmatch 403 system\_user
 Redirectmatch 403 \/\(null\)\/
 Redirectmatch 403 clientrequest
 Redirectmatch 403 option\_value
 RedirectMatch 403 ref\.outcontrol
 # SPECIFIC EXPLOITS
 RedirectMatch 403 errors\.
 RedirectMatch 403 config\.
 RedirectMatch 403 include\.
 RedirectMatch 403 display\.
 RedirectMatch 403 register\.
 Redirectmatch 403 password\.
 RedirectMatch 403 maincore\.
 RedirectMatch 403 authorize\.
 Redirectmatch 403 macromates\.
 RedirectMatch 403 head\_auth\.
 RedirectMatch 403 submit\_links\.
 RedirectMatch 403 change\_action\.
 Redirectmatch 403 com\_facileforms\/
 RedirectMatch 403 admin\_db\_utilities\.
 RedirectMatch 403 admin\.webring\.docs\.
 Redirectmatch 403 Table\/Latest\/index\.
</IfModule>
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^$
#RewriteCond %{HTTP_HOST} !^(www\.)?simlove\.ru$ [NC]
#RewriteCond %{HTTP_HOST}---%{REQUEST_URI} ^([^\.]+)\.test.socum\.ru---/([^/]+)? [NC]
#RewriteCond %1---%2 !^(.*)---\1$ [NC]
#RewriteRule ^(.*)$ http://test.socum.ru/!%1$1 [R=301,L]
#RewriteRule ^@(.*)$ /account/?u=$1
php_value upload_max_filesize 32M
php_value memory_limit -1
php_value post_max_size 32M
<Files "*.dat">
deny from all
</Files>
<Files *.sql>
order allow,deny
deny from all
</Files>
<Files *.dev>
order allow,deny
deny from all
</Files>
# задаем соответствие mime типов расширению
AddType text/vnd.wap.wml;charset=utf-8 .wml
AddType application/vnd.sonyericsson.mms-template tpl
AddType application/vnd.wap.wmlc .wmlc
AddType text/vnd.wap.wmlscript .wmls
AddType application/vnd.wap.wmlscriptc .wmlsc
AddType image/vnd.wap.wbmp .wbmp
AddType application/vnd.eri.thm .thm 
AddType application/vnd.mophun.application .mpn  
AddType application/vnd.mophun.certificate .mpc
AddType text/vnd.sun.j2me.app-descriptor .jad
Addtype text/x-vmel .mel
Addtype audio/imelody .imy
AddType application/vnd.smaf .mmf
Addtype text/x-vmel .emy
AddType audio/amr .amr
AddType audio/x-wav .wav
AddType application/x-tar .hid
Addtype image/jpeg .jpg 
Addtype image/jpeg .jpeg 
Addtype image/gif .gif 
Addtype image/png .png 
Addtype image/bmp .bmp 
Addtype text/x-imelody .imy 
Addtype text/x-emelody .emy 
Addtype text/x-vcard .vcf 
Addtype text/x-vcalendar .vcs 
Addtype text/calendar .ics 
Addtype application/smil .smil 
Addtype application/smil .smi 
Addtype application/java-archive .jar 
Addtype application/vnd.symbian.install .sis 
Addtype audio/wav .wav 
Addtype audio/midi .midi 
Addtype audio/midi .mid 
Addtype audio/rmf .rmf 
Addtype application/vnd.wap.mms-message .mms 
AddType video/flv .flv
AddType video/mp4 .mp4
Addtype video/3gpp .3gp
Addtype application/zip .zip
Addtype audio/mpeg .mp3
# переопределяем страницы ошибок
ErrorDocument 400 /software/error/?err=400
ErrorDocument 401 /software/error/?err=401
ErrorDocument 402 /software/error/?err=402
ErrorDocument 403 /software/error/?err=403
ErrorDocument 404 /software/error/?err=404
ErrorDocument 500 /software/error/?err=500
ErrorDocument 502 /software/error/?err=502
#Включаем отслеживание сим-ссылок
Options +FollowSymLinks
#Запускаем url_rewriting
RewriteEngine On
#Блокируем все ссылки, содержащие <script>
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#Блокируем все скрипты, которые пытаются изменить переменные PHP Globals:
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#Блокируем все скрипты, которые пытаются изменить переменную _REQUEST:
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
#Перенаправляем все подобные на страницу с ошибкой 403 - запрещено
RewriteRule ^(.*)$ index.php [F,L]
# Защита от XSS
<ifModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>
# Сжимаем элементы с помощью mod_deflate
<ifmodule mod_deflate.c="">
<filesmatch .(js|css)$="">
SetOutputFilter DEFLATE
</filesmatch>
</ifmodule>