H
H
helixly2015-08-13 23:49:52
PHP
helixly, 2015-08-13 23:49:52

Redirect in htaccess to URL without trailing slash (Bitrix)?

Good afternoon! There is a task to remove the closing slash from folders in the URL (needed for seo). Bitrix processes paths in two ways. It can be a physically existing folder on the disk that contains the index.php file and virtual paths for the CNC implementation. So, if there is a folder, for example, support, and I write example.com/support - without a slash, you need to open the index.php file in the support folder, and the slash at the end is not substituted by the server. Plus, the Bitrix CNC should work correctly. Here is the current one (aka standard bitrix htaccess)

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

<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>

Actually everything is simple, if not a file/folder/link is redirected to urlrewrite.php which handles the virtual address. Found something like DirectorySlash Off, don't know if it is or not but at least it doesn't redirect to the url with a slash but gives a 403 error. Please help, I'm confused!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Voropaev, 2015-08-14
@SV0L0Ch

Try checking the rules for this address in urlrewrite.php and in the infoblock settings, maybe you need to fix it there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question