Answer the question
In order to leave comments, you need to log in
How to remove the trailing slash in the address bar?
Greetings!
We have, say, the following site structure on Bitrix:
/poezda/index.php
...
/kontakty.php
<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>
<!-- В конце ссылок нет слешей -->
site.ru/kontakty/
$arUrlRewrite = array(
array(
"CONDITION" => "#^/poezda#",
"PATH" => "/poezda/index.php",
)
);
#^/poezda#
, #^/poezda
, /poezda
etc. <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>
Answer the question
In order to leave comments, you need to log in
I will assume that you add slashes at the server level, and not at the level of the site itself. And changes in urlrewrite do not affect the addition of slashes in any way, since this file is designed to parse url and include the necessary file for processing. And a question just in case: maybe some module for Bitrix is installed, which adds slashes?
Are there any rules for redirecting pages without a slash to pages with a slash in .htaccess somewhere above the specified block?
You can also use the Yandex service https://webmaster.yandex.ru/tools/server-response/ to check the status of pages like site.ru/poezda/poezd2
I checked it on one of my sites, it worked for me as it should with the following changes to htaccess take.ms/N3WEE:
1. Add the DirectorySlash Off
line to the mod_dir section
2. Add the lines
RewriteCond %{REQUEST_URI} ^.*[^/]$
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}/index.php -f
RewriteRule ^(.*) to the mod_rewrite section $ /$1/index.php [L] Section
index pages now open with or without a slash at the end.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question