Greetings

We have, say, the following Bitrix site structure:

<a href="http://site.ru/poezda">Поезда</a> <a href="http://site.ru/poezda/poezd1">Поезд 1</a> <a href="http://site.ru/poezda/poezd2">Поезд 2</a> <a href="http://site.ru/kontakty">Контакты</a> <!-- В конце ссылок нет слешей --> 

When clicking on the first (Train) or last (Contacts) links, a slash is added to the end of the address bar, i.e. it turns out http://site.ru/poezda/ or http://site.ru/kontakty/ respectively.
I understand this is due to the fact that these are "Sections" (Folders that contain .section.php and index.php files)

Can you please tell me how to get rid of these slashes at the end?


PS Standard .htaccess file contains these lines for routing:

 <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On 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> 

UPD :

when adding a rule to urlwrite.php, nothing has changed: (

 $arUrlRewrite = array( array( "CONDITION" => "#^/poezda#", "PATH" => "/poezda/index.php", ) ); 

in CONDITION tried to specify various variations, such as #^/poezda# , #^/poezda , /poezda , etc.


UPD 2

When you try to add a file (and not a section) and describe a rule, a slash is still added at the end. How to overcome this rule?

    3 answers 3

    Add to mod_dir :

     DirectorySlash Off 

    Add to mod_rewrite :

     RewriteCond %{REQUEST_URI} ^.*[^/]$ RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}/index.php -f RewriteRule ^(.*)$ /$1/index.php [L] 

      In Bitrix, there is (/ as seen from .htaccess) file /bitrix/urlrewrite.php, but here's the catch, one thing you want to create routes that are not (virtual) and then the lack of a slash is valid, but when you are trying to create a real directory remove it then the question arises, why?

      • the desire of the customer :) - Nikolai
       RewriteRule ^(.*)/?$ /bitrix/urlrewrite.php [L] 

      If the problem is in processing, add a possible slash to the Rewrite rules.

      If in aesthetics - edit urlrewrite.php

      • RewriteRule ^(.*)/?$ /bitrix/urlrewrite.php [L] - did not help. Can you tell me more about aesthetics, please? - Nikolay
      • sort of figured out, but did not help. Updated the question, have any ideas? = \ - Nikolai