Options -Indexes
ErrorDocument 402 http://site.ru/static/404.php
ErrorDocument 403 http://site.ru/static/404.php
ErrorDocument 404 http://site.ru/static/404.php
ErrorDocument 500 http://site.ru/static/404.php
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^test\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteCond %{HTTP:range} !(^bytes=[^,]+(,[^,]+){0,4}$|^$)
RewriteRule .* - [F]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.site\.ru$ [NC]
RewriteCond %{HTTP_HOST} !^www\.site\.ru$ [NC]
RewriteCond %{HTTP_HOST} !^test\.site\.ru$ [NC]
RewriteRule ^(.*)$ redirect.php?id=%1 [QSA,L]