There is a file

/bitrix/modules/main/include/urlrewrite.php 

It is necessary to make changes to it.

Transferred it to the folder

 /local/bitrix/modules/main/include/urlrewrite.php 

, made changes, but they did not apply.

Then I decided to attach to the event in init.php, however, I did not find in the documentation an event that occurs at the time of the transition to the store's product card (you need to track availability, and if 0, then perform some actions).

Tell me how to properly override the desired file in Bitrix, in order to avoid kernel edits?

  • one
    This file belongs to the Bitrix kernel and cannot be changed. Transferring to the locale will not give anything - Dmitry Kozlov
  • one
    urlrewrite for editing usually lies in the root of the site. - Nikolaj Sarry
  • colleagues correctly say: the file is not modified, it cannot be redefined, the system does not offer such functionality, because it is considered that it is not necessary. Could you describe what exactly does not suit you there and why do you want to change it? Maybe then we can give you advice on how to do it correctly - Artem Malahov
  • It is necessary to redirect the user to the parent category in the case when the product, to the page of which he (the user) goes, is inactive. I think, in this file it would be possible to place the corresponding method. - Sergey
  • since he is responsible for the 404th redirect - Sergey

0