M
M
Maria Popova2021-02-10 16:11:09
1C-Bitrix
Maria Popova, 2021-02-10 16:11:09

Why won't htaccess work in the bitrix directory?

you need to redirect from the page without a slash at the end to the pages with a slash at the end, also from index.php, index.html, index.htm to the folder itself.
CMS Bitrix.
htaccess says:
RewriteRule (^|.*?/)index\.(php|html|htm)$ https://%{HTTP_HOST}/$1 [R=301,QSA,L]
RewriteRule (^|.*? /)index\/$ https://%{HTTP_HOST}/$1 [R=301,QSA,L]

works well on the main one, works on the secondary sites with a redirect from index.php and without a slash, but does not work at all in the directory.
Tell me what could be

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2021-02-10
@shambler81

Wrote here
https://klondike-studio.ru/standards/standartnyy-h...
Thanks to cap "marked as resolved"

A
Anton, 2021-02-10
@anton99zel

Options -Indexes 
ErrorDocument 404 /404.php
php_flag display_errors on
php_value error_reporting 6143
php_value memory_limit 256M
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ https://site.ru/ [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ https://site.ru/ [R=301,L]
RewriteCond %{REQUEST_URI} !^/bitrix/admin/1c_exchange\.php$
RewriteCond %{REQUEST_URI} !^/system/import/from1c_custom\.php$
RewriteCond %{SERVER_PORT} !^443$     [OR]
RewriteCond %{HTTP_HOST} ^www\.       [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
RewriteCond %{THE_REQUEST} //
RewriteRule .* /$0 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [R=301,L]

<IfModule mod_php7.c>
  php_flag session.use_trans_sid of
  php_value display_errors 1
  #php_value mbstring.internal_encoding UTF-8
</IfModule>

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
RewriteCond %{THE_REQUEST} /(.*)index.php.*$
RewriteCond %{THE_REQUEST} !bitrix/admin/
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>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question