MyBB Community Forums

Full Version: Return correct HTTP status codes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The default MyBB forum/thread/user not found/does not exist pages return HTTP status code 200 (success) currently. I think that PHP's http_response_code function should be used and make those pages return the correct HTTP 404 status code.

Could this be extended to make the 'no permissions' error page return a status code of 403 (forbidden) or 401 (unauthorised)?
I think the Google SEO plugin does proper 404s however this would be a nice enhancement to MyBB.
I would definitely like to see this in the core too.
Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/2864

Thanks for contributing to MyBB!

Regards,
The MyBB Group
Google SEO does it - not just 404 but any code you like, it's customizable for each error label. Basically you can assign an error code to each $lang[error_*] if you like, so it also works for plugin errors as long as they're raised the same way and the error message is present in $lang.

Some hosts do not pass through custom error pages (and I don't know how proxies like cloudflare interpret them) so it should be a setting.
(2017-10-06, 03:43 PM)frostschutz Wrote: [ -> ]Google SEO does it - not just 404 but any code you like, it's customizable for each error label. Basically you can assign an error code to each $lang[error_*] if you like, so it also works for plugin errors as long as they're raised the same way and the error message is present in $lang.

Some hosts do not pass through custom error pages (and I don't know how proxies like cloudflare interpret them) so it should be a setting.

Yep, it's one of the reasons I use Google SEO Smile

Worthwhile trying to fix it in the core, though I don't know if we'll end up going to the lengths of allowing custom codes per error string, though there will definitely be a setting (enabled by default) to disable it.