Skip to content

Commit 34e37c3

Browse files
ScIT-RaphaelKristan Kenney
authored andcommitted
Do not add www alias to subdomains by default
1 parent 2202d26 commit 34e37c3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

bin/v-add-web-domain

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ if [ "$aliases" = 'none' ]; then
114114
else
115115
ALIAS="www.$domain"
116116
if [ -z "$aliases" ]; then
117-
ALIAS="www.$domain"
117+
# Check and skip www alias for subdomains.
118+
IFS='.' read -r -a domain_elements <<< "$domain"
119+
if [ "${#domain_elements[@]}" -gt 2 ]; then
120+
ALIAS=""
121+
else
122+
ALIAS="www.$domain"
123+
fi
118124
else
119125
ALIAS="$aliases"
120126
fi

web/js/pages/add_web.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ App.Listeners.WEB.keypress_domain_name();
174174
$(function() {
175175
$('#v_domain').change(function() {
176176
var prefix = 'www.';
177-
document.getElementById('v_aliases').value = prefix + document.getElementById('v_domain').value;
177+
if (((document.getElementById('v_domain').value).split(".")).length > 2) {
178+
document.getElementById('v_aliases').value = "";
179+
} else {
180+
document.getElementById('v_aliases').value = prefix + document.getElementById('v_domain').value;
181+
}
178182
});
179183
App.Actions.WEB.toggle_letsencrypt($('input[name=v_letsencrypt]'))
180184

0 commit comments

Comments
 (0)