R
R
run1822020-02-07 17:09:57
1C-Bitrix
run182, 2020-02-07 17:09:57

How to configure the CNC so that invalid links return a 404 response?

The site has a page /info/stock/index.php. It has a list of stocks in the bitrix:news component. There is a rule in urlrewrite.php - 'CONDITION' => '#^/info/stock/#' .

As a result, both the list and details of the stock are displayed correctly on the site, for example, at /info/stock/fevral/. But links like /info/stock/fevral/abcd123/ also work - they give a page with a list of stocks.

How can I configure the processing of only correct links, and the rest 404?
The fact that such /info/stock/fevral/abcd123/ links are shown is a Bitrix bug or is everything ok?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail, 2020-02-07
@run182

configure the 404th page through unit.php (there are many options on the internet)
through define("ERROR_404"), after pre-writing the condition on defined('ERROR_404') in the function in init.php, you can go to the 404th anywhere
in In the component, write the condition that if there are no results for stocks, then @define("ERROR_404")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question