Requests | Blesta

Requests

Domain and Hosting Ordering: Disallow www on front of domains

Rob @ Press Wizards shared this idea 2 years 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.

Comments (4)

photo
1

should be www. as a subdomain. otherwhise wwwideasexamplellc.com would not work. So a "filter" should catch subdomains or be ablocklist for certain strings (admin managed such as: google, bing, bank,....)

photo
1

It is a subdomain with the period "www." so that wwwideas.com works but http://www.greatdomain.com does not.

photo
1

As an additional option: Add the text "www." in front of the form field. This way, the potential customer sees that he does not still have to enter it.

photo
2

Yep I tried this first, customers do not see it and enter www. anyway. My code prevents it completely, and I think should be added as an Admin checkbox option, it's so easy to add.

photo