Requests | Blesta

Requests

Domain and Hosting Ordering: Disallow www on front of domains

Rob @ Press Wizards shared this idea 2 weeks ago
Under Consideration

So many customers order hosting, and very often include "www." in the front of their domain, which then gets provisioned etc and requires reconfiguring their hosting account, and then editing their Service to remove it, etc.

In core/Util/Validate/Server.php there's isDomain() which is used by what looks like every module to validate a domain, so adding the following code at the top of that function works great:

// Domain may not contain www.

if (strpos($domain, 'www.') === 0) {

return false;

}

Perhaps add an Admin option to reject "www." on the front, in case there's a use case that should allow it? But for 99% of Blesta Admins, it is def not needed.

I also edited the language file of the module I use to add "without www", so the error is now:

'Please enter a valid domain name, e.g. domain.com without www';

and the domain field is now:

'Website Domain (without www)';

For the Plesk module, the language file is here:

components/modules/plesk/language/en_us/plesk.php

My edits are:

$lang['Plesk.!error.plesk_domain.format'] = 'Please enter a valid domain name, e.g. domain.com without www';

and

$lang['Plesk.service_field.domain'] = 'Website Domain (without www)';

Hope this helps others.