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.

How to redirect multiple domains to a single domain ?

Discussion in 'General Discussion' started by spanna, Jul 21, 2014.

  1. spanna

    spanna Registered

    Joined:
    Jul 21, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I would like to know how to setup my server to catch all Name Servers which are pointed to my server. There are around 40-50 domains pointed at my nameserver and I would like to redirect all of them to my primary domain.

    Actually the point is... I had a hosting client, who stopped paying me, so I deleted his account but their nameservers at still pointing at my nameservers. I would like to know if there's a way I can get their traffic with out the need of creating accounts for each domain.
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    You can alter the default docroot. To do this:

    Code:
    cp /var/cpanel/templates/apache2/main.default /var/cpanel/templates/apache2/main.local
    
    Edit this:

    Code:
    # Default vhost for unbound IPs
    
    <VirtualHost *>
        ServerName [% servername %]
        DocumentRoot [% serverroot %]/htdocs
        ServerAdmin [% serveradmin %]
        [%- IF supported.mod_suphp %]
        <IfModule mod_suphp.c>
            suPHP_UserGroup nobody nobody
        </IfModule>
        [%- END %]
        [%- IF supported.mod_userdir && userdirprotect_enabled && defaultvhost.userdirprotect != '-1' %]
        UserDir disable
        [%- IF defaultvhost.userdirprotect != '' %]
        UserDir enabled [% defaultvhost.userdirprotect %]
        [%- END -%]
        [%- END %]
    </VirtualHost>
    
    You'll want to put the docroot of where your site files are located, and adjust the user/group as needed. Then:

    Code:
    /scripts/rebuildhttpdconf
    service httpd restart
    
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

Share This Page