https://dd-blog.ru/file-settings-htaccess-for-1c-bitrix-cms/
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
Options -Indexes ErrorDocument 404 /404.php <IfModule mod_php5.c> php_flag session.use_trans_sid off #php_flag default_charset UTF-8 #php_value display_errors 1 </IfModule> <IfModule mod_php7.c> php_flag session.use_trans_sid off #php_flag default_charset UTF-8 #php_value display_errors 1 </IfModule> <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / # редирект с 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 в конце алиаса RewriteRule ^(.*)index\.php$ $1 [R=301,L] # убираем дубли / RewriteCond %{REQUEST_URI} ^(.*)/{2,}(.*)$ RewriteRule . %1/%2 [R=301,L] # добавляем / в конце алиасов RewriteCond %{REQUEST_URI} ^(.*)/$ RewriteRule .* - [L] RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [L] RewriteCond %{REQUEST_METHOD} =GET RewriteCond %{REQUEST_URI} ^(.*)/index.php$ RewriteRule ^(.*)$ %1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$ RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L] RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}] </IfModule> <IfModule mod_dir.c> DirectoryIndex index.php index.html </IfModule> <IfModule mod_setenvif.c> SetEnv TZ Europe/Moscow </IfModule> <IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE text/plain text/html AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/rss+xml AddOutputFilterByType DEFLATE application/json AddOutputFilterByType DEFLATE application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon </IfModule> </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> |