.htaccess для MODX сайта

.htaccess для MODX сайта

Правильный htaccess с редиректом на https и редиректом с www

а так-же кеш файлов

поменяйте sitename на название вашего сайта

RewriteEngine On

RewriteBase /

RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} ^www\. [NC]

RewriteRule ^(.*)$ https://sitename.ru/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} ^(.+)/$

RewriteRule ^(.+)/$ /$1 [R=301,L]

ExpiresActive on

ExpiresDefault "access plus 1 days"

ExpiresByType application/javascript "access plus 1 days"

ExpiresByType text/javascript "access plus 1 days"

ExpiresByType text/css "access plus 1 days"

ExpiresByType text/html "access plus 1 days"

ExpiresByType text/x-javascript "access plus 1 days"

ExpiresByType image/gif "access plus 1 days"

ExpiresByType image/jpeg "access plus 1 days"

ExpiresByType image/png "access plus 1 days"

ExpiresByType image/jpg "access plus 1 days"

ExpiresByType image/x-icon "access plus 1 days"

ExpiresByType application/x-shockwave-flash "access plus 1 days"

<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf|doc|docx)$">

Header set Cache-Control "max-age=86400"

</FilesMatch>

AddDefaultCharset utf-8

AddType 'text/html; charset=utf-8' .html .htm .shtml