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 test1.example.com redirects to gotest1.com, test2.example.com redirects to gotest2.com
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) mydomain.com.
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} ^mysubdomain.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysubdomain.example.com$
RewriteRule ^(.*)$ http://www.targetdomain.com [R=301,L]
All the existing rewrites like the above are fine and working well.
For example gadgets.mydomain.com 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 fake.mydomain.com) 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 http://forum.modrewrite.com/viewtopi...5a242e 4f8641 , I tried similar to this code:
RewriteEngine on
RewriteRule ^(.*) http://www.test.com/$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,
jimmy
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 test1.example.com redirects to gotest1.com, test2.example.com redirects to gotest2.com
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) mydomain.com.
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} ^mysubdomain.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysubdomain.example.com$
RewriteRule ^(.*)$ http://www.targetdomain.com [R=301,L]
All the existing rewrites like the above are fine and working well.
For example gadgets.mydomain.com 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 fake.mydomain.com) 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 http://forum.modrewrite.com/viewtopi...5a242e 4f8641 , I tried similar to this code:
RewriteEngine on
RewriteRule ^(.*) http://www.test.com/$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,
jimmy