To be precise, my website is currently being redirected to appID-appspot
How can I force a redirect to my custom domain ?
That is, when gets "appID-appspot", redirect to "custom domain".
To be precise, my website is currently being redirected to appID-appspot.
How can I force a redirect to my custom domain ?
That is, when gets "appID-appspot.", redirect to "custom domain".
Share Improve this question asked Feb 21, 2017 at 12:43 Coder1000Coder1000 4,50110 gold badges38 silver badges87 bronze badges2 Answers
Reset to default 3You can use regular expression route matching of express.
app.get(/appID-appspot./, function (req, res) {
res.redirect('custom_domain');
}
/appID-appspot./
matches the url
and redirects to customdomain, if the URL contains that part.
Add the above to top of the routes so that it gets redirected first.
You should use res.redirect(301, 'http://example.');
Full example:
router.get('/', function(req, res){
res.redirect(301, 'custom domain');
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745421897a4627002.html
评论列表(0条)