Answer the question
In order to leave comments, you need to log in
How to make a redirect between domains - from www.site.ru to site.ru?
I tried everything on the express:
console.log(req.headers.host,req.url);
if(req.headers.host.substr(0,4)=='www.'){
res.writeHead(302, {
'Location': req.headers.host.substr(4)
});
res.end();
//res.redirect(req.headers.host.substr(4));//+req.url
console.log('redirect');
}else next();
Answer the question
In order to leave comments, you need to log in
+ there is no point in doing a standard thing in an abnormal place.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question