I want to migrate my WP blog to ghost, the permalinks have the same slug (/blogWP.com/title-article
and blogGhost.com/title-article
) but I still have pages such as blog.com/category for instance to redirect.
Is there any way to make 301 redirections in Ghost as I would do in a .htaccess file ?
Thx !
It's possible to redirect through ghost itself directly, but you need to alter the core. Though I'm not sure it's the perfect or proper way.
open core/server/errorHandling.js
find this line:
error404: function (req, res, next) {
Add below:
res.status(301);
res.set({'Location': 'http://your-new-wordpress-blog-url'+req.url});
res.send('301','Not found');
This way, Instead of showind 404s, I redirect to my wordpress' new domain (http://your-new-wordpress-blog-url
in the example)
This way, www.ghost.url/not-a-valid-page
will redirect to http://your-new-wordpress-blog-url/not-a-valid-page
instead of showing the Ghost's 404 page.
p.s: This redirects, but I'm not 100% sure the headers are correct, I'd appreciate if someone else would clarify.