diff options
author | tomsmeding <tom.smeding@gmail.com> | 2018-02-18 11:29:57 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2018-02-18 11:30:12 +0100 |
commit | 117141c6250862a0c62695e846daac3df362d873 (patch) | |
tree | 525a0ea7802fd6fa37c3f70364a7991411bd04f9 | |
parent | 3e3a12ffdf285a48cd6cbbef65094750401caf2f (diff) |
Redirect to index.html instead of serving directly
-rwxr-xr-x | webserver.js | 2 |
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; |