W
W
WebLedNik2020-08-29 18:28:50
htaccess
WebLedNik, 2020-08-29 18:28:50

How to fix .htaccess to open site pages?

For a reason unknown to me, pages on the site stopped opening after updating the .htaccess file.

File contents:

Options -Indexes 
ErrorDocument 404 /404.php


  php_flag session.use_trans_sid off
  #php_flag default_charset UTF-8
  #php_value display_errors 1


<IfModule mod_php7.c>
  php_flag session.use_trans_sid off
  #php_flag default_charset UTF-8
  #php_value display_errors 1
</IfModule>

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^.*$ $0.php [L,QSA]
  RewriteCond %{THE_REQUEST} ([^\s]*)\.php(\?[^\s]*)?
  RewriteRule (.*) %1 [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_expires.c>
  ExpiresActive on
  ExpiresByType image/jpeg "access plus 3 day"
  ExpiresByType image/gif "access plus 3 day"
  ExpiresByType image/png "access plus 3 day"
  ExpiresByType text/css "access plus 3 day"
  ExpiresByType application/javascript "access plus 3 day"  
</IfModule>


The problems started when I added the following code (in mod_rewrite.c and mod_dir.c :

Options -Indexes 
ErrorDocument 404 /404.php


  php_flag session.use_trans_sid off
  #php_flag default_charset UTF-8
  #php_value display_errors 1

<IfModule mod_php7.c>
  php_flag session.use_trans_sid off
  #php_flag default_charset UTF-8
  #php_value display_errors 1
</IfModule>

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^.*$ $0.php [L,QSA]
  RewriteCond %{THE_REQUEST} ([^\s]*)\.php(\?[^\s]*)?
  RewriteRule (.*) %1 [R=301,L]

  RewriteCond %{REQUEST_URI} ^.*[^/]$
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}/index.php -f
  RewriteRule ^(.*)$ /$1/index.php [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
  DirectorySlash Off
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresByType image/jpeg "access plus 3 day"
  ExpiresByType image/gif "access plus 3 day"
  ExpiresByType image/png "access plus 3 day"
  ExpiresByType text/css "access plus 3 day"
  ExpiresByType application/javascript "access plus 3 day"  
</IfModule>


The page files are in the root directory.

Link to the video with the problem: https://yadi.sk/i/feghsxH6Dg-OCA

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WebLedNik, 2020-08-29
@WebLedNik

I had to clear the cache in the browser)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question