﻿#Устанавливаем кодировку
AddDefaultCharset UTF-8


#Отключаем вывод ошибок
php_value error_reporting "E_ALL & ~E_NOTICE"

#Московское время
php_value date.timezone "Europe/Moscow"

#Главная страница
DirectoryIndex index.php

#Mod Rewrite
RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?func=category&translit=$1 [L,QSA]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).html$ index.php?func=video&category=$1&translit=$2 [L,QSA]
RewriteRule ^comment/([a-zA-Z0-9_-]+).html$ index.php?func=comment&translit=$1 [L,QSA]
RewriteRule ^download/(.*).mp4 index.php?func=download&translit=$1 [L,QSA]
RewriteRule ^view_(.*)$ index.php?func=view&video=$1 [L,QSA]
RewriteRule ^tags/(.*).html$ index.php?func=tags&tag=$1 [L,QSA]
RewriteRule ^deletion_(.*).html$ index.php?func=deletion&id=$1 [L,QSA]
RewriteRule ^editing_(.*).html$ index.php?func=editing&id=$1 [L,QSA]
RewriteRule ^system.html?$ system.php [L,QSA]

<IfModule mod_gzip.c>
    mod_gzip_on         Yes
    mod_gzip_dechunk    Yes
    mod_gzip_item_include file		\.(html?|txt|css|js|php|pl)$
    mod_gzip_item_include mime		^text\.*
    mod_gzip_item_include mime		^application/x-javascript.*
    mod_gzip_item_exclude mime		^image\.*
    mod_gzip_item_exclude rspheader	^Content-Encoding:.*gzip.*
</IfModule>

<ifModule mod_headers.c>
    #кэшировать html и htm файлы на один день
    <FilesMatch "\.(html|htm)$">
        Header set Cache-Control "max-age=43200"
    </FilesMatch>
    #кэшировать css, javascript и текстовые файлы на одну неделю
    <FilesMatch "\.(js|css|txt)$">
        Header set Cache-Control "max-age=604800"
    </FilesMatch>
    #кэшировать флэш и изображения на месяц
    <FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png)$">
        Header set Cache-Control "max-age=2592000"
    </FilesMatch>
    #отключить кэширование
    <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
        Header unset Cache-Control
    </FilesMatch>
</IfModule>

<ifModule mod_expires.c>
    ExpiresActive On
    #по умолчанию кеш в 5 секунд
    ExpiresDefault "access plus 5 seconds"
    #кэшировать флэш и изображения на месяц
    ExpiresByType image/x-icon "access plus 2592000 seconds"
    ExpiresByType image/jpeg "access plus 2592000 seconds"
    ExpiresByType image/png "access plus 2592000 seconds"
    ExpiresByType image/gif "access plus 2592000 seconds"
    ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
    #кэшировать css, javascript и текстовые файлы на одну неделю
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 604800 seconds"
    ExpiresByType application/javascript "access plus 604800 seconds"
    ExpiresByType application/x-javascript "access plus 604800 seconds"
    #кэшировать html и htm файлы на один день
    ExpiresByType text/html "access plus 43200 seconds"
    #кэшировать xml файлы на десять минут
    ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>

ErrorDocument 404 /index.php?error