Created
October 24, 2018 07:54
-
-
Save madeas/5a5d675268db18731c1c207bc4e7c2ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options All -ExecCGI -Indexes -Includes +FollowSymLinks | |
DirectoryIndex index.html | |
AddDefaultCharset utf-8 | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
# RewriteCond %{HTTPS} !on | |
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] | |
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] | |
# убираем .html веб страниц | |
RewriteCond %{REQUEST_URI} !\.[a-zA-Z0-9]{2,4} | |
RewriteCond %{REQUEST_URI} !/$ | |
RewriteRule ^(.*)$ $1.html | |
#Добавление слеша к url | |
RewriteCond %{REQUEST_URI} /+[^.]+$ | |
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] | |
</IfModule> | |
<IfModule mod_setenvif.c> | |
SetEnv TZ Europe/Moscow | |
</IfModule> | |
ServerSignature Off | |
<ifModule mod_php.c> | |
php_value upload_max_filesize 32M | |
php_value post_max_size 10M | |
php_value default_charset utf-8 | |
php_value max_execution_time 200 | |
</ifModule> | |
<IfModule mod_deflate.c> | |
AddEncoding gzip .gz | |
AddOutputFilterByType DEFLATE image/x-icon | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE text/javascript | |
AddOutputFilterByType DEFLATE application/x-javascript | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/json | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE application/xml | |
AddOutputFilterByType DEFLATE image/svg+xml | |
</IfModule> | |
<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 X-Content-Type-Options "nosniff" | |
</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 | |
ExpiresDefault "access plus 1 month" | |
# CSS | |
ExpiresByType text/css "access plus 1 year" | |
# Data interchange | |
ExpiresByType application/json "access plus 0 seconds" | |
ExpiresByType application/xml "access plus 0 seconds" | |
ExpiresByType text/xml "access plus 0 seconds" | |
# Favicon (cannot be renamed!) | |
ExpiresByType image/x-icon "access plus 1 week" | |
# HTML components (HTCs) | |
ExpiresByType text/x-component "access plus 1 month" | |
# HTML | |
ExpiresByType text/html "access plus 0 seconds" | |
# JavaScript | |
ExpiresByType application/javascript "access plus 1 year" | |
# Manifest files | |
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" | |
ExpiresByType text/cache-manifest "access plus 0 seconds" | |
# Media | |
ExpiresByType audio/ogg "access plus 1 month" | |
ExpiresByType image/gif "access plus 1 month" | |
ExpiresByType image/jpeg "access plus 1 month" | |
ExpiresByType image/png "access plus 1 month" | |
ExpiresByType video/mp4 "access plus 1 month" | |
ExpiresByType video/ogg "access plus 1 month" | |
ExpiresByType video/webm "access plus 1 month" | |
# Web feeds | |
ExpiresByType application/atom+xml "access plus 1 hour" | |
ExpiresByType application/rss+xml "access plus 1 hour" | |
# Web fonts | |
ExpiresByType application/font-woff2 "access plus 1 month" | |
ExpiresByType application/font-woff "access plus 1 month" | |
ExpiresByType application/vnd.ms-fontobject "access plus 1 month" | |
ExpiresByType application/x-font-ttf "access plus 1 month" | |
ExpiresByType font/opentype "access plus 1 month" | |
ExpiresByType image/svg+xml "access plus 1 month" | |
</ifModule> | |
# Bad Rquest | |
ErrorDocument 400 /400.html | |
# Authorization Required | |
ErrorDocument 401 /401.html | |
# Forbidden | |
ErrorDocument 403 /403.html | |
# Not found | |
ErrorDocument 404 /404.html | |
# Method Not Allowed | |
ErrorDocument 405 /405.html | |
# Request Timed Out | |
ErrorDocument 408 /408.html | |
# Request URI Too Long | |
ErrorDocument 414 /414.html | |
# Internal Server Error | |
ErrorDocument 500 /500.html | |
# Not Implemented | |
ErrorDocument 501 /501.html | |
# Bad Gateway | |
ErrorDocument 502 /502.html | |
# Service Unavailable | |
ErrorDocument 503 /503.html | |
# Gateway Timeout | |
ErrorDocument 504 /504.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment