227 lines
8.9 KiB
ApacheConf
227 lines
8.9 KiB
ApacheConf
|
|
<IfModule mod_headers.c>
|
|||
|
|
Header append Vary Accept env=REDIRECT_accept
|
|||
|
|
</IfModule>
|
|||
|
|
<IfModule mod_mime.c>
|
|||
|
|
AddType image/webp .webp
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<IfModule mod_rewrite.c>
|
|||
|
|
RewriteEngine On
|
|||
|
|
RewriteCond %{HTTP_ACCEPT} image/webp
|
|||
|
|
RewriteCond %{REQUEST_URI} (.*)(\.(jpe?g|png))$
|
|||
|
|
RewriteCond %{DOCUMENT_ROOT}/%1\_webp.webp -f
|
|||
|
|
RewriteRule .* %1_webp\.webp [L,T=image/webp]
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
<IfModule mod_rewrite.c>
|
|||
|
|
RewriteEngine On
|
|||
|
|
RewriteCond %{REQUEST_URI} (.*)(\.(jpg))$
|
|||
|
|
RewriteCond %{DOCUMENT_ROOT}/%1_jpg\.jpg -f
|
|||
|
|
RewriteRule .* %1_jpg\.jpg [L,T=image/jpg]
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
<IfModule mod_rewrite.c>
|
|||
|
|
RewriteEngine On
|
|||
|
|
RewriteCond %{REQUEST_URI} (.*)(\.(png))$
|
|||
|
|
RewriteCond %{DOCUMENT_ROOT}/%1_png\.png -f
|
|||
|
|
RewriteRule .* %1_png\.png [L,T=image/png]
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<IfModule mod_rewrite.c>
|
|||
|
|
RewriteEngine on
|
|||
|
|
Options +FollowSymlinks
|
|||
|
|
|
|||
|
|
RewriteRule ^(.*).md index.php [L]
|
|||
|
|
|
|||
|
|
RewriteRule ^config.php$ index.php [L]
|
|||
|
|
RewriteRule ^robots.txt$ index.php [L]
|
|||
|
|
RewriteRule ^sitemap.xml$ index.php [L]
|
|||
|
|
RewriteRule ^yml.xml$ index.php [L]
|
|||
|
|
|
|||
|
|
RewriteCond %{HTTP_HOST} ^www\.(.*)$
|
|||
|
|
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]
|
|||
|
|
|
|||
|
|
|
|||
|
|
#RewriteCond %{REQUEST_FILENAME} !-f
|
|||
|
|
#RewriteCond %{REQUEST_URI} !(.*)/$
|
|||
|
|
#RewriteCond %{REQUEST_FILENAME} !-f
|
|||
|
|
#RewriteRule ^(.+[^/])$ /$1/ [R=301,L]
|
|||
|
|
|
|||
|
|
#RewriteRule ^api/?([^/]+)?/?([^/]+)?/$ module/api.php?module=$1&action=$2&%{QUERY_STRING} [L]
|
|||
|
|
RewriteRule ^api/([^/]+)?/?([^/]+)?/$ index.php?api=1&module=$1&action=$2&%{QUERY_STRING} [L]
|
|||
|
|
|
|||
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|||
|
|
RewriteRule ^.*$ index.php?%{QUERY_STRING} [L]
|
|||
|
|
|
|||
|
|
</ifModule>
|
|||
|
|
|
|||
|
|
AddType application/x-javascript .js
|
|||
|
|
|
|||
|
|
#AddType application/octet-stream .docx .mov .pdf .xlsx
|
|||
|
|
|
|||
|
|
AddType application/vnd.ms-word.document.macroEnabled.12 docm
|
|||
|
|
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
|
|||
|
|
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
|
|||
|
|
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
|
|||
|
|
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
|
|||
|
|
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
|
|||
|
|
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
|
|||
|
|
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
|
|||
|
|
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
|
|||
|
|
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
|
|||
|
|
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
|
|||
|
|
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
|
|||
|
|
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
|
|||
|
|
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
|
|||
|
|
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
|
|||
|
|
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#--------------------
|
|||
|
|
|
|||
|
|
<IfModule mod_deflate.c>
|
|||
|
|
|
|||
|
|
|
|||
|
|
# force deflate for mangled headers
|
|||
|
|
# developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
|
|||
|
|
<IfModule mod_setenvif.c>
|
|||
|
|
<IfModule mod_headers.c>
|
|||
|
|
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
|
|||
|
|
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
|
|||
|
|
</IfModule>
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<IfModule !mod_filter.c>
|
|||
|
|
# Legacy versions of Apache
|
|||
|
|
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
|
|||
|
|
AddOutputFilterByType DEFLATE application/javascript
|
|||
|
|
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
|
|||
|
|
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
|
|||
|
|
AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
|
|||
|
|
</IfModule>
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
# FileETag None is not enough for every server.
|
|||
|
|
<IfModule mod_headers.c>
|
|||
|
|
Header unset ETag
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
|
|||
|
|
# Since we`re sending far-future expires, we don't need ETags for static content.
|
|||
|
|
# developer.yahoo.com/performance/rules.html#etags
|
|||
|
|
FileETag None
|
|||
|
|
|
|||
|
|
# ----------------------------------------------------------------------
|
|||
|
|
# Кроссдоменные изображения (CORS-enabled images) (@crossorigin)
|
|||
|
|
# ----------------------------------------------------------------------
|
|||
|
|
# Отсылать CORS заголовки, если браузер требует их, для изображений по умолчанию включено.
|
|||
|
|
# http://developer.mozilla.org/en/CORS_Enabled_Image
|
|||
|
|
# http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
|
|||
|
|
# http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
|
|||
|
|
# wiki.mozilla.org/Security/Reviews/crossoriginAttribute
|
|||
|
|
|
|||
|
|
<IfModule mod_setenvif.c>
|
|||
|
|
<IfModule mod_headers.c>
|
|||
|
|
# mod_headers, ну почему ты не определяешь Content-Type?!
|
|||
|
|
<FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">
|
|||
|
|
SetEnvIf Origin ":" IS_CORS
|
|||
|
|
Header set Access-Control-Allow-Origin "*" env=IS_CORS
|
|||
|
|
</FilesMatch>
|
|||
|
|
</IfModule>
|
|||
|
|
</IfModule>
|
|||
|
|
|
|||
|
|
|
|||
|
|
# ----------------------------------------------------------------------
|
|||
|
|
# Задаем Expires заголовки (срок актуальности файла) (для лучшего кэширования)
|
|||
|
|
# ----------------------------------------------------------------------
|
|||
|
|
# Указываются заголовки с большим сроком "годности",
|
|||
|
|
# предполагается, что вы используете кэш на основе названий файлов (all.css?v001).
|
|||
|
|
# В дополнение, учтите, что старые прокси могут кэшировать не верно
|
|||
|
|
# http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
|
|||
|
|
|
|||
|
|
# Если вы не используете названия файлов для контроля версий, измените кэш для CSS и JS, например на
|
|||
|
|
# "access plus 1 week".
|
|||
|
|
<IfModule mod_expires.c>
|
|||
|
|
ExpiresActive on
|
|||
|
|
|
|||
|
|
# Задаем значение по умолчанию (для всех файлов)
|
|||
|
|
ExpiresDefault "access plus 1 month"
|
|||
|
|
|
|||
|
|
# cache.appcache нельзя кэшировать в FF 3.6 (спасибо Remy ~Introducing HTML5)
|
|||
|
|
ExpiresByType text/cache-manifest "access plus 0 seconds"
|
|||
|
|
|
|||
|
|
# Ваш html документ
|
|||
|
|
<FilesMatch \.(html|xhtml|xml|shtml|phtml|php|txt)$>
|
|||
|
|
ExpiresDefault "access plus 0 seconds"
|
|||
|
|
</FilesMatch>
|
|||
|
|
ExpiresByType text/html "access plus 0 seconds"
|
|||
|
|
|
|||
|
|
# Данные
|
|||
|
|
ExpiresByType text/xml "access plus 0 seconds"
|
|||
|
|
ExpiresByType application/xml "access plus 0 seconds"
|
|||
|
|
ExpiresByType application/json "access plus 0 seconds"
|
|||
|
|
|
|||
|
|
# Рассылка
|
|||
|
|
ExpiresByType application/rss+xml "access plus 1 hour"
|
|||
|
|
ExpiresByType application/atom+xml "access plus 1 hour"
|
|||
|
|
|
|||
|
|
# Favicon (не может быть переименован)
|
|||
|
|
<FilesMatch \.(ico)$>
|
|||
|
|
ExpiresDefault "access plus 1 week"
|
|||
|
|
</FilesMatch>
|
|||
|
|
ExpiresByType image/x-icon "access plus 1 week"
|
|||
|
|
|
|||
|
|
# Медиа: изображения, видео, аудио
|
|||
|
|
<FilesMatch \.(gif|png|jpg|jpeg|ogg|mp4|mkv|flv|swf|wmv|asf|asx|wma|wax|wmx|wm)$>
|
|||
|
|
ExpiresDefault "access plus 1 year"
|
|||
|
|
</FilesMatch>
|
|||
|
|
ExpiresByType image/gif "access plus 1 month"
|
|||
|
|
ExpiresByType image/png "access plus 1 month"
|
|||
|
|
ExpiresByType image/jpeg "access plus 1 month"
|
|||
|
|
ExpiresByType video/ogg "access plus 1 month"
|
|||
|
|
ExpiresByType audio/ogg "access plus 1 month"
|
|||
|
|
ExpiresByType video/mp4 "access plus 1 month"
|
|||
|
|
ExpiresByType video/webm "access plus 1 month"
|
|||
|
|
|
|||
|
|
# HTC файлы (css3pie)
|
|||
|
|
ExpiresByType text/x-component "access plus 1 month"
|
|||
|
|
|
|||
|
|
# Веб-шрифты
|
|||
|
|
<FilesMatch \.(eot|ttf|otf|svg|woff)$>
|
|||
|
|
ExpiresDefault "access plus 1 year"
|
|||
|
|
</FilesMatch>
|
|||
|
|
ExpiresByType application/x-font-ttf "access plus 1 month"
|
|||
|
|
ExpiresByType font/opentype "access plus 1 month"
|
|||
|
|
ExpiresByType application/x-font-woff "access plus 1 month"
|
|||
|
|
ExpiresByType image/svg+xml "access plus 1 month"
|
|||
|
|
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
|
|||
|
|
|
|||
|
|
# CSS и JavaScript
|
|||
|
|
<FilesMatch \.(css|js)$>
|
|||
|
|
ExpiresDefault "access plus 1 year"
|
|||
|
|
</FilesMatch>
|
|||
|
|
ExpiresByType text/css "access plus 1 year"
|
|||
|
|
ExpiresByType application/javascript "access plus 1 year"
|
|||
|
|
|
|||
|
|
# Статичные ресурсы
|
|||
|
|
<FilesMatch \.(swf|pdf|doc|rtf|xls|ppt)$>
|
|||
|
|
ExpiresDefault "access plus 1 year"
|
|||
|
|
</FilesMatch>
|
|||
|
|
ExpiresByType application/x-shockwave-flash "access plus 1 year"
|
|||
|
|
ExpiresByType application/pdf "access plus 1 year"
|
|||
|
|
ExpiresByType application/msword "access plus 1 year"
|
|||
|
|
ExpiresByType application/rtf "access plus 1 year"
|
|||
|
|
ExpiresByType application/vnd.ms-excel "access plus 1 year"
|
|||
|
|
ExpiresByType application/vnd.ms-powerpoint "access plus 1 year"
|
|||
|
|
</IfModule>
|