L
L
ligisayan2018-06-22 19:42:24
HTML
ligisayan, 2018-06-22 19:42:24

Where in htaccess is blocking access to any html files?

There is a site on which I cannot confirm access to the Google console due to the fact that access to any html files is blocked. At the same time, access to text txt is open.
Can't find where it's blocked in htaccess file

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 ==========

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kim, 2018-06-22
@ligisayan

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]

The penultimate line is allowed to access text files.
To add the ability to access html add:
RewriteCond %{REQUEST_URI} !\.(html|txt)$ [NC]

N
nozzy, 2018-06-22
@nozzy

RewriteCond %{REQUEST_URI} !\.txt$ [NC]
open txt files
Redirect to index.php when requesting other files (including html)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question