Is their any Plugin for 404 page to 301 redirect ?
-
Hi
Is their any Plugin for 404 redirect ? Because i am getting lots of url's I need to 301 redirect respectively.
Because my last forum was on WordPress then shift to NodeBB now. But older urls are crawl by Google and when user visit to this url it shows us 404 page not found.
-
I am not aware of any plugins that do it, but we have a hook that can be used for this. https://github.com/NodeBB/NodeBB/blob/master/src/controllers/404.js#L17.
Keep in mind this hook replaces the entire 404 functionality of core, so you need to handle your urls and for other urls you still need to send a proper 404 back.
-
I would just put these redirects in at the reverse proxy level, in your nginx config for example.
-
You would use the hook
'action:meta.override404'
and do ahelpers.redirect(res, '/');
You might have to copy some of the code from https://github.com/NodeBB/NodeBB/blob/master/src/controllers/404.js#L24-L44. So you don't redirect requests to javascript files to the homepage for example.