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.

Remove www from subdomain url.

Discussion in 'General Discussion' started by cPanel Admin, Jul 18, 2007.

  1. cPanel Admin

    cPanel Admin Registered

    Joined:
    Jul 16, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    What line of code can I place on a .htaccess so that the visitors may no acess a subdomain placing the following:

    http://www.sub.domain.com/

    And get instantly, and by default, the subdomain url like this:

    http://sub.domain.com/

    The subdomain I am refering to, was created individually as a new account thru WHM, and its not a subdomain created on a main cPanel account.
     
  2. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    Place the below code in the .htaccess file under the subdomain you have created and check.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.sub\.domain\.com$
    RewriteRule ^/(.*) http://subdomain.com/$1 [L,R]

    replace 'subdomain.com' the actual subdomain name.
     
  3. cPanel Admin

    cPanel Admin Registered

    Joined:
    Jul 16, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I placed like this:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.foruns\.cpaneladmin\.net$
    RewriteRule ^/(.*) http://foruns.cpaneladmin.net/$1 [L,R]
    
    Options All -Indexes
    
    It doesn´t worked, probably it´s not the way you are telling me to do, humn?
     
  4. Frimon86

    Frimon86 BANNED

    Joined:
    Jun 4, 2007
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    0
  5. cPanel Admin

    cPanel Admin Registered

    Joined:
    Jul 16, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    If you place on the web any subdomain with www. before its name, it will work.

    No, I haven´t, I am trying to seek for an alternative for this problem of mine without bothering the cPanel staff too much :)
     
Loading...

Share This Page