any idea on how i can do this in Express 3.0? As the non-www url is causing very odd problems in different areas of the website.
Thanks!
So i found the answer from another question.
Node.js: 301 redirect non-www without express
Sorry for not searching before
app.get ('/*', function (req, res, next){
if (!req.headers.host.match(/^www\./)){
res.writeHead (301, {'Location': 'http://mysite.com'});
}else{
return next();
}
});