How to redirect multiple domains to a single domain ?

spanna

Registered
Jul 21, 2014
3
0
51
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.
 

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
833
28
178
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

You can also edit the default website page via:

"WHM Home » Account Functions » Web Template Editor"

Thank you.