Redirects

This commit is contained in:
2018-07-28 19:41:55 +02:00
parent 5c269f2e92
commit 58d3c6ca08
2 changed files with 3 additions and 5 deletions

View File

@ -192,12 +192,10 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
bool redir = true; bool redir = true;
if (!noRedirect) { if (!noRedirect) {
if (host == "necronda.net") { if (getWebRoot(host).empty()) {
req.redirect(303, "https://www.necronda.net/"); req.redirect(303, "https://www.necronda.net" + req.getPath());
} else if (socket->getSocketPort() != 443) { } else if (socket->getSocketPort() != 443) {
req.redirect(303, "https://" + host + req.getPath()); req.redirect(303, "https://" + host + req.getPath());
} else if (getWebRoot(host).empty()) {
req.redirect(303, "https://www.necronda.net" + req.getPath());
} else { } else {
redir = false; redir = false;
} }

View File

@ -195,7 +195,7 @@ string getWebRoot(string host) {
if (fileExists(root)) { if (fileExists(root)) {
return root; return root;
} else { } else {
return "/"; return "";
} }
} }