Merge branch 'master' of github.com:TerribleDev/redirect.tparnell.io

This commit is contained in:
Tommy Parnell
2016-09-13 11:57:01 -04:00

View File

@@ -4,8 +4,19 @@ var app = express();
var port = process.env.PORT || 3000;
app.get('/*', function (req, res) {
var host = S(req.headers.host);
var host = S(req.headers.host.split(':')[0]);
var hostToString = host.toString();
//todo regex
console.log(hostToString);
if(hostToString === "tparnell.io"){
return res.redirect(301, 'https://about.tparnell.io');
}
if(hostToString === "tommyparnell.com" || hostToString === "www.tommyparnell.com"){
return res.redirect(301, 'https://about.tommyparnell.com');
}
if(hostToString === "terribledev.io"){
return res.redirect(301, 'https://about.terribledev.io');
}
if(host.contains('github')){
return res.redirect(301, 'https://github.com/TerribleDev');
}
@@ -16,10 +27,10 @@ app.get('/*', function (req, res) {
return res.redirect(301,'https://bitbucket.org/TerribleDev/');
}
if(host.contains('blog')){
return res.redirect(301,'http://blog.tparnell.io');
return res.redirect(301,'http://blog.terribledev.io');
}
if(host.contains('resume')){
return res.redirect(301,'http://resume.tparnell.io');
return res.redirect(301,'http://resume.terribledev.io');
}
res.end("Redirect layer for tommyparnell.com, tparnell.io, and other domains :D");
});