summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2018-02-18 11:29:57 +0100
committertomsmeding <tom.smeding@gmail.com>2018-02-18 11:30:12 +0100
commit117141c6250862a0c62695e846daac3df362d873 (patch)
tree525a0ea7802fd6fa37c3f70364a7991411bd04f9
parent3e3a12ffdf285a48cd6cbbef65094750401caf2f (diff)
Redirect to index.html instead of serving directly
-rwxr-xr-xwebserver.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/webserver.js b/webserver.js
index 549aebd..554dc03 100755
--- a/webserver.js
+++ b/webserver.js
@@ -107,7 +107,7 @@ function requestFile(req,res,listdirs,path){
.replace("[/*LISTINGLISTING*/]",JSON.stringify(items))
);
} else if(stats.isDirectory()&&fs.readdirSync(fname).indexOf("index.html")!=-1){
- res.sendFile(node_path.join(fname,"index.html"));
+ res.redirect(301, node_path.join(fname,"index.html"));
} else {
res.status(404).send("That file does not exist.");
return;