@ligisayan

Где в htaccess блокируется доступ к любым файлам html?

Есть сайт на котором не могу подтвердить доступ в гугл консоли в силу того, что блокируется доступ к любым html файлам. К текстовым txt доступ при этом открыт.

Не могу обнаружить где это блокируется в файле htaccess

AddDefaultCharset UTF-8
RewriteEngine On
RewriteBase /
Options -Indexes

RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^.htaccess$ - [F]
RewriteRule ^favicon.ico$ _img/favicon.ico [L]
RewriteRule ^[a-z]{2}/files/.*$ index.php [L]
RewriteRule ^_img/number\.png.*$ index.php [L]
RewriteCond %{REQUEST_URI} !\.txt$ [NC]
RewriteRule ^.*$ index.php [L]

<ifModule mod_php5.c>
php_value expose_php Off
php_value display_errors Off
php_value session.use_trans_sid 0
php_value register_globals Off
php_value magic_quotes_gpc Off
php_value post_max_size 6M
php_value upload_max_filesize 5M
</ifModule>

ErrorDocument 404 /sitemap/
ErrorDocument 403 /sitemap/

#========== GOOGLE ==========
<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 handler ^cgi-script$
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>
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg|eot|ttf|woff)$">
Header set Cache-Control "max-age=604800, public"
</filesMatch>

<filesMatch ".(html|htm)$">
Header set Cache-Control "max-age=14400, must-revalidate"
</filesMatch>

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</ifModule>
#========== GOOGLE ==========
  • Вопрос задан
  • 90 просмотров
Решения вопроса 1
kimono
@kimono
Web developer
RewriteRule ^.htaccess$ - [F]
RewriteRule ^favicon.ico$ _img/favicon.ico [L]
RewriteRule ^[a-z]{2}/files/.*$ index.php [L]
RewriteRule ^_img/number\.png.*$ index.php [L]
RewriteCond %{REQUEST_URI} !\.txt$ [NC]
RewriteRule ^.*$ index.php [L]

В предпоследней строке разрешено обращаться к текстовым файлам.
Чтобы добавить возможность обращаться к html допишите:
RewriteCond %{REQUEST_URI} !\.(html|txt)$ [NC]
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@nozzy
Symfony, Laravel, SQL
RewriteCond %{REQUEST_URI} !\.txt$ [NC]
открывать txt-файлы
RewriteRule ^.*$ index.php [L]
При запросе других файлов (включая html) перенаправлять на index.php
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы