M
M
Maxim2019-01-17 04:18:54
OctoberCMS
Maxim, 2019-01-17 04:18:54

How to return 404 response code from OctoberCMS page?

I must say right away that I only know about OctoberCMS that it exists, I have no practical experience.
There is a RainLab Blog component (which is free) for OctoberCMS, by default it displays all posts, even those that are not marked for publication. I filter this case in the overridden template (I just check whether it is published or not - this is not correct, but I did not think of another way). It is necessary to give a 404 response and show an error page if the post was removed from publication and they are trying to get it via a direct link.
The search showed only how to do it from the component, but I don’t know how to override the component, if you make changes to the component, all changes will be overwritten after the update.
Is it possible to return 404 from the page (fragment), or how to override the component code so that everything does not become dust after the update?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2019-01-17
@mavsan

Heh didn’t google it :(
It turns out that this is a feature . If you are logged in as amdin, all records are displayed, even those that are hidden, so that you can see how it looks :)
But even in this case - when you go to the direct address to a hidden record - it displays only the text that there is no such entry, but the code is 200.
Perhaps this is the correct behavior.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question