Идеальный htaccess

ND
На сайте с 17.10.2016
Offline
29
551

Помогите пожалуйста оптимизировать htaccess для сайта на битриксе.

Попытался прописать редиректы на без www, вырезаются из url index.php/index.html, редирект при двух и более слешей в url, включил кэширование и сжатие. По редиректам мне кажется слишком сложно получилось. Не будет ли тормозить это сайт? Нужно ли как то его оптимизировать или может еще какие либо правила посоветуете добавить.

Options -Indexes 

ErrorDocument 404 /404.php

<IfModule mod_php5.c>
php_flag session.use_trans_sid off
#php_value display_errors 1
#php_value mbstring.internal_encoding UTF-8
php_value mbstring.internal_encoding cp1251

php_value mbstring.func_overload 2
php_value max_input_vars 10000
</IfModule>

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

RewriteCond %{THE_REQUEST} ^GET.*index\.html [NC]
RewriteRule (.*?)index\.html/*(.*) /$1$2 [R=301,NE,L]

RewriteCond %{REQUEST_URI} !/bitrix/admin/.* [NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !.html$
RewriteCond %{REQUEST_URI} !.php$
RewriteRule (.+) $1/ [R=301,L]

RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [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_headers.c>
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
<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 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"
ExpiresByType text/html "access plus 43200 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>

<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</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>
suffix
На сайте с 26.08.2010
Offline
325
#1

У Вас сайт на шаред хостинге ?

Клуб любителей хрюш (https://www.babai.ru)
ND
На сайте с 17.10.2016
Offline
29
#2
suffix:
У Вас сайт на шаред хостинге ?

Да, на тайм вебе

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий