attempt redirect from www.heartb.it to heartb.it

This commit is contained in:
2011-12-25 01:35:05 +00:00
parent 916607aae0
commit 7c9a70ed42
2 changed files with 14 additions and 0 deletions

8
app.js
View File

@@ -9,6 +9,14 @@
app.set('views', __dirname + '/views');
app.set('view engine', 'coffee');
app.register('.coffee', require('coffeekup').adapters.express);
app.use(function(req, res, next) {
console.log("Hostname: %s", req.header('Host'));
if (req.header('Host') === 'www.heartb.it') {
return res.redirect('http://heartb.it/');
} else {
return next();
}
});
app.use(express.bodyParser());
app.use(express.methodOverride());
return app.use(express.static(__dirname + '/public'));

View File

@@ -8,6 +8,12 @@ app.configure ->
app.set 'views', __dirname + '/views'
app.set 'view engine', 'coffee'
app.register '.coffee', require('coffeekup').adapters.express
app.use (req, res, next) ->
console.log "Hostname: %s", req.header('Host')
if req.header('Host') == 'www.heartb.it'
res.redirect('http://heartb.it/')
else
next()
app.use express.bodyParser()
app.use express.methodOverride()
app.use express.static(__dirname + '/public')