sferrerowebimpacto Posted September 21, 2021 Share Posted September 21, 2021 (edited) Hello, I've modified the Dispatcher.php class so, when the url is modified and it doens't match the real product url it will redirect you to the 404 page, this is they code I've used to redirect it: Tools::redirect('index.php?controller=404'); I get redirected to my 404 page, but the problem is that, along with the 404 (red arrow), a 302 from the redirect is send (yellow arrow). I've also tried using: Controller::getController('PageNotFoundController')->run(); But I receive this screen instead of my 404 website: Is there a way of forcing the 404 without the 302? Thanks. Edited September 21, 2021 by sferrerowebimpacto (see edit history) Link to comment Share on other sites More sharing options...
sferrerowebimpacto Posted September 28, 2021 Author Share Posted September 28, 2021 (edited) In case anyone has this problem in the future what I ended up doing was putting this code inside de init function of ProductController when it meets my condition: header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); $this->setTemplate('errors/404'); Edited September 28, 2021 by sferrerowebimpacto (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now