Browse Source

When specifying a domain without a subdomain, add a www. version automatically.

Longer term we will probably need a 301 redirect in these cases for SEO purposes, but this is a nice convenience feature for now.
qdn
CalDescent 3 years ago
parent
commit
60f96d15bd
  1. 9
      src/main/java/org/qortal/settings/Settings.java

9
src/main/java/org/qortal/settings/Settings.java

@ -504,14 +504,15 @@ public class Settings {
return this.domainMapLoggingEnabled;
}
public List<DomainMap> getDomainMap() {
return this.domainMap;
}
public Map<String, String> getSimpleDomainMap() {
HashMap<String, String> map = new HashMap<>();
for (DomainMap dMap : this.domainMap) {
map.put(dMap.getDomain(), dMap.getName());
// If the domain doesn't include a subdomain then add a www. alternative
if (dMap.getDomain().chars().filter(c -> c == '.').count() == 1) {
map.put("www.".concat(dMap.getDomain()), dMap.getName());
}
}
return map;
}

Loading…
Cancel
Save