E
E
Eleg2020-09-23 17:36:38
htaccess
Eleg, 2020-09-23 17:36:38

Index.html is not removed on other pages, how to do it?

Hello, the essence of the problem is that index.html is removed for some reason only on the main page, but it needs to be done at all, please help

Options All  -Indexes -Includes +FollowSymLinks
RewriteEngine on
RewriteBase /
DirectoryIndex index.html
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
<IfModule mod_rewrite.c> 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ 
RewriteRule ^index\.html$ http://%{HTTP_HOST}/ [R=301,L]
</IfModule>
<IfModule mod_setenvif.c>
  SetEnv TZ Europe/Moscow
</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 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>
</IfModule>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dodo512, 2020-09-23
@Eleg

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ 
RewriteRule ^index\.html$ http://%{HTTP_HOST}/ [R=301,L]

Change this rule to:
RewriteCond %{THE_REQUEST} ^[^?]+/index\.html
RewriteRule ^(|.*/)index\.html$ https://%{HTTP_HOST}/$1 [R=301,L]

D
Dimonchik, 2020-09-23
@dimonchik2013

not necessary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question