Source Code:
(back to article)
Submit
Result:
Report an issue
9
1
2
3
4
5
6
7
8
›
var http = require("http");
var url = require("url");
http.createServer(function(req, res) {
var pathname = url.parse(req.url).pathname;
res.writeHead(301,{Location: 'http://w3docs.com/' + pathname});
res.end();
}).listen(8888);
var http = require("http"); var url = require("url"); http.createServer(function(req, res) { var pathname = url.parse(req.url).pathname; res.writeHead(301,{Location: 'http://w3docs.com/' + pathname}); res.end(); }).listen(8888);