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?