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 canonical issues

Discussion in 'General Discussion' started by Asia Expat, May 3, 2009.

  1. Asia Expat

    Asia Expat Member

    Joined:
    Apr 22, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I have a set of canonical 301 redirects in place in htaccess... i.e. example.com redirects to www.example.com.

    However, it's causing problems with subdomains and beta.example.com becomes example.com/beta/

    The general consensus with Apache experts is that the htaccess code is not the problem, rather there is something within cPanel clashing with the htaccess code. Are there any cPanel engineers or gurus here that can suggest what might be causing this issue? The code from htaccess is below...

    Code:
    # Externally redirect requests for non-blank, non-canonical hostnames to canonical hostnames
    #
    # Canonicalize "newservice"
    RewriteCond %{HTTP_HOST} newservice\.example\.com
    RewriteCond %{HTTP_HOST} !^newservice\.example\.com$
    RewriteRule ^(.*)$ http://newservice.example.com/$1 [R=301,L]
    #
    # Canonicalize "beta"
    RewriteCond %{HTTP_HOST} beta\.example\.com
    RewriteCond %{HTTP_HOST} !^beta\.example\.com$
    RewriteRule ^(.*)$ http://beta.example.com/$1 [R=301,L]
    #
    # Canonicalize all others
    RewriteCond %{HTTP_HOST} example\.com$ [NC]
    RewriteCond %{HTTP_HOST} !^(www|newservice|beta)\.example\.com$
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
     
    #1 Asia Expat, May 3, 2009
    Last edited: May 3, 2009
  2. Asia Expat

    Asia Expat Member

    Joined:
    Apr 22, 2008
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I'd really rather not bother the cPanel team with a support ticket over this issue... is there anyone that might have any ideas what aspect of cPanel may be clashing with the redirects, causing the subdomains do redirect to the subdirectory?
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,446
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Not sure if this is helpful, but, you know what you want to do, but are using code that appears to not have been generated by cPanel's redirect tool.
    Why not remove all of this and re-add it manually using the redirect tool feature. This way you know it will work with cPanel.
     
Loading...

Share This Page