The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

subdomain problem

Discussion in 'General Discussion' started by ofen, Mar 8, 2014.

  1. ofen

    ofen Registered

    Joined:
    Mar 8, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I am Brazilian and I am using a translator.
    For the purpose of redirecting to the main page of a website that users enter wrong its domain. I created some subdomains like w.domain.com, wwww.domain.com, ww.domain.com, etc.
    However, when trying to create a www.www.domain.com for this same purpose I got the following response: "Sorry, www cannot be used in subdomains. It is implicitly added to all newly created subdomains. ".
    Wondering what the www is a subdomain created automatically and therefore the www.www should work, I created the DNS entries for the www.www.domain.com, and to work around the problem in cPanel subdomains I created the *. www.domain.com (with wildcard), still I did not succeed. The server to answer now, but I don't understand to what folder inside the subdomain points.
    See an example:
    - removed -

    To me this seems to be a bug. An unexpected situation.
    I appreciate any help.
     
    #1 ofen, Mar 8, 2014
    Last edited by a moderator: Mar 8, 2014
  2. robb3369

    robb3369 Well-Known Member

    Joined:
    Mar 1, 2008
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Actually www is not a sub-domain that is added, its a cname record that point to the domain name...

    I think to address your issue, you can go into cPanel and add a sub-domain with an * (asterisks) so the sub-domain is *.domain.com and points to the /public_html/ directory...

    Now, in your site's .htaccess file, use something like this:
    Code:
    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	RewriteBase /
    	RewriteCond %{HTTP_HOST} !^www\.domain\.com
    	RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] 
    </IfModule>
    That will redirect the user to www.domain.com site, regardless of what sub-domain they typed into the browser to get there...
     
  3. ofen

    ofen Registered

    Joined:
    Mar 8, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Thank you so much. It worked!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page