diff --git a/domain.module b/domain.module
index f8f4890..0aac564 100644
--- a/domain.module
+++ b/domain.module
@@ -1297,6 +1297,10 @@ function domain_valid_domain($subdomain) {
   if ($subdomain != drupal_strtolower($subdomain)) {
     $error_list[] = t('Only lower-case characters are allowed.');
   }
+  // Check for 'www' prefix if redirection / handling is enabled under global domain settings.
+  if (variable_get('domain_www', 1) && (substr($subdomain, 0, strpos($subdomain, '.')) == 'www')) {
+    $error_list[] = t('WWW prefix handling: Domains must be registered without the www. prefix.');
+  }
   // Allow modules to alter this behavior.
   drupal_alter('domain_validate', $error_list, $subdomain);
   // Return the errors, if any.
diff --git a/tests/domain.test b/tests/domain.test
index 826fd04..d5532e3 100644
--- a/tests/domain.test
+++ b/tests/domain.test
@@ -231,6 +231,14 @@ class DomainCreateTest extends DomainTestCase {
     $conf['domain_allow_non_ascii'] = TRUE;
     $return = domain_validate('$%#!.com');
     $this->assertTrue(empty($return), t('ASCII character override value allowed.'));
+    // Test for the www. prefix when 'WWW prefix handling' is disabled.
+    $conf['domain_www'] = 0;
+    $return = domain_validate('www.example.com');
+    $this->assertTrue(empty($return), t('<em>WWW prefix handling</em> disabled: Domains can be registered with the www. prefix.'));
+    // Test for the www. prefix when 'WWW prefix handling' is enabled.
+    $conf['domain_www'] = 1;
+    $return = domain_validate('www.example.com');
+    $this->assertTrue(!empty($return), t('<em>WWW prefix handling</em> enabled: Domains must be registered without the www. prefix.'));
   }
 
 }
