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.

Redirecting subdomains unlisted in Cpanel to one domain address only?

Discussion in 'General Discussion' started by jimmybutcher, Mar 27, 2007.

  1. jimmybutcher

    jimmybutcher Registered

    Mar 27, 2007
    Likes Received:
    Trophy Points:
    Hello folks,

    I am a newbie in the area of domain management. I have some existing subdomains redirecting to some internet sites (not just to mine), the existing subdomains have been already created and listed in Cpanel Subdomains menu. In this way, existing subdomains work fine, for example redirects to, redirects to
    The problem is the rest of the non-existing subdomains which are not listed in Cpanel, calling them I just get a kind of green Apache and Cpanel introduction page (or placeholder page) from my host company. I use Cpanel provided by my host company, no virtual private server used. I want to avoid this Cpanel intro/placeholder page, so in case of any non-existing/Cpanel unlisted subdomain I would like to have a redirection to (let's say)
    The existing subdomains have their own directories and .htaccess files under public_html directory, their rewrite code are similar to this:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^$ [OR]
    RewriteCond %{HTTP_HOST} ^$
    RewriteRule ^(.*)$ [R=301,L]

    All the existing rewrites like the above are fine and working well.

    For example listed in Cpanel means that there is a directory structure like root/public_html/gadgets and a .htaccess file in gadgets directory. I could modify this .htaccess file in gadgets directory and the system listened to my change. So I am quite sure that the rewrite rules are working for subdomains which are listed in Cpanel Subdomains menu.

    My intension is to try to keep the mechanism above (as well as the different redirections of the existing subdomains) and redirect the non-existing subdomains to one domain only.

    For a non-existing/Cpanel unlisted subdomain (like has no directory under root/public_html, so that should be one of the reasons why I get the Cpanel intro/placeholder page.

    According to what I found in a topic 4f8641 , I tried similar to this code:

    RewriteEngine on
    RewriteRule ^(.*)$1 [P,L]

    I placed my attempt into the .htaccess file of the root as well as the .htaccess file of the public_html, not working !
    I only get the Cpanel intro/placeholder page from my host company when calling non-existing subdomains. I think there should be a way to solve this problem, please help me. I tried to create several custom error handling pages, no way (but this area can also have a solution, I don't know).

    Do you have any idea?

    Thank you in advance,


Share This Page