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.

Wildcard subdomains redirecting somewhere else

Discussion in 'General Discussion' started by sevent, Jan 3, 2010.

  1. sevent

    sevent Registered

    Joined:
    Jan 3, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I setup a bunch of domain names while logged in as a reseller. All of the domain names have wildcard DNS entries:

    * 14400 in CNAME thedomain.com.

    However, anytime you visit:

    whatever.thedomain.com

    you are actually redirected to:

    mainResellerDomain.com

    instead. How do I change this behavior?

    Many thanks!
     
  2. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    Please check virtualhost entries of domains in Apache configuration file (/usr/local/apache/conf/httpd.conf) and make sure that the document root of domains are correct.
     
  3. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    The problem is with the VirtualHost entry in the Apache configuration. Make sure the ServerAlias is set as follows

    ServerAlias www.thedomain.com *.thedomain.com

    in the 'thedomain.com' domains VirtualHost entry and also check the DocumentRoot. BTW, have you assigned a dedicated IP for the thedomain.com domain?
     
  4. sevent

    sevent Registered

    Joined:
    Jan 3, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hum... this could be an issue. The only "ServerAlias" entry right now for the domains in httpd.conf is:

    Code:
    ServerAlias www.theDomain.com
    madaboutlinux are you sure you have the right order for the ServerAlias directive in terms of the wildcard vs the main domain?

    None of the sites (except the main reseller) has their own IP address. There are a very large number of them, so I can't give them all IPs. Also, this will make editing httpd.conf a pain, unless there's already some script out there for adding these entries?

    Finally, do you know if there is any way to do this using .htaccess? It would be much easier for me to add something to each domain's .htaccess then to edit all the httpd.conf entries.

    Thanks for your responses.
     
  5. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    I asked about the dedicated IP for a different reason. BTW, edit the httpd.conf file and scroll down to the VirtualHost entry of "theDomain.com" and change ServerAlias to

    and make sure *.thedomain.com entry is not present in any other VirtualHost entry especially check the main reseller domain virtualhost entry. Once done, restart the httpd service.

    And well, I haven't seen using ServerAlias in .htaccess.
     
Loading...

Share This Page