View file hosting-img/.htaccess

File size: 3.38Kb
# Author:: Flowap
# Name:: Миша Трунев
# Vk:: https://vk.com/getmanrus

AddDefaultCharset UTF-8
RewriteEngine On
DirectoryIndex index.php

## EXPIRES CACHING ##
# Включаем кэш в браузерах посетителей
<ifModule mod_headers.c>
    # Все html и htm файлы будут храниться в кэше браузера один день
    <FilesMatch "\.(html|htm)$">
        Header set Cache-Control "max-age=43200"
    </FilesMatch>
    # Все css, javascript и текстовые файлы будут храниться в кэше браузера одну неделю
    <FilesMatch "\.(js|txt)$">
        Header set Cache-Control "max-age=604800"
    </FilesMatch>
    # Все флэш файлы и изображения будут храниться в кэше браузера один месяц
    <FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png|svg)$">
        Header set Cache-Control "max-age=2592000"
    </FilesMatch>
    # Отключаем кеширование php и других служебных файлов
    <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 1 month"
    ExpiresByType image/jpeg "access plus 4 weeks"
    ExpiresByType image/png "access plus 30 days"
    ExpiresByType image/gif "access plus 43829 minutes"
    ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
    # Включаем кэширование css, javascript и текстовых файлов на одну неделю
    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>
## EXPIRES CACHING ##
#Редирект с протокола http на https.#
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Редирект с www на без www.#
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
#Редирект с index.php#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ https://conff.org/ [R=301,L]

# Загрузка файлов
RewriteRule ^uploads/$ m/upl.php [L,QSA]
RewriteRule ^uploads/add/([0-9]*)/$ m/upl.php?add=$1 [L,QSA]
# Просмотр фото
RewriteRule ^([0-9a-z]*)/([0-9a-z]*)/?$ m/files.php?url1=$1&url2=$2 [L,QSA]
# Авторизация на проекте
RewriteRule ^login$ m/log.php [L,QSA]



ErrorDocument 400 /m/error.php?act=400
ErrorDocument 401 /m/error.php?act=401
ErrorDocument 403 /m/error.php?act=403
ErrorDocument 404 /m/error.php?act=404
ErrorDocument 500 /m/error.php?act=500