Help - Search - Members - Calendar
Full Version: redirecting non-existing subdomains?
The Planet Forums > Control Panels > cPanel/WHM
jimmybutcher
Hello folks,

I am not the client of The Planet here, so if it is not allowed to answer my question, no problem.

I am a newbie in the area of domain management. I have some existing subdomains redirecting to some internet sites (not just to mine), work fine.
The problem is the rest of the non-existing subdomains, calling them I just get a kind of green Apache and Cpanel introduction page from my host company (which is not The Planet). I want to avoid this intro page, so in case of any non-existing subdomain I would like to have a redirection to (let's say) mydomain.com.
I have Cpanel, no virtual private server used. The existing subdomains have their own directories and .htaccess files (public_html directory is the parent), 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.

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.
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 intro page of my host company when calling non-existing subdomains. I tried to create several custom error handling pages, no way (but this area can also have a solution, I don't know).

Thank you for any possible help,


jimmybutcher
markcausa
It's allowed for us to answer your questions! We're always happy to.

Give me a few minutes to read over this and possibly try what you want in WHM and I'll post back.

smile.gif
markcausa
Okay. I'm gonna admit I'm not quite sure what you're talking about but I think you mean this:
if you go to "somefakesub.domain.com" you see a green page with some orange letters and a little rundown about cPanel.

You should go into WHM > Edit DNS for that Domain and check down the list very carefully to see if those "non existent" subdomains have an entry or entries in there. They might have existed at one time and are still in there. It never hurts to delete old, unused entries anyway. wink.gif

If no such luck, try posted on the cPanel forums. They might be able to throw some more ideas at you.


PS: You might want to consider coming over to The Planet. They're great to host with! cool.gif
markcausa
Did you find any entries after all? Were you able to resolve the issue of the holding page?

In some builds of cPanel/WHM, there was a system in which their goal was to eliminate propagation times on new sub-domains by having a holding page for non-existing ones.

/scripts/upcp might fix it or there might be old entries like I said. Please let me know. smile.gif
jimmybutcher
"It's allowed for us to answer your questions! We're always happy to."

That's very kind, thanks.

"Okay. I'm gonna admit I'm not quite sure what you're talking about but I think you mean this:
if you go to "somefakesub.domain.com" you see a green page with some orange letters and a little rundown about cPanel."

"You should go into WHM > Edit DNS for that Domain and check down the list very carefully to see if those "non existent" subdomains have an entry or entries in there. They might have existed at one time and are still in there. It never hurts to delete old, unused entries anyway. wink.gif"

- Almost. Sorry, my description was quite bad, here is another one:

Indeed, if I go to "somefakesub.domain.com" I see a green page with some orange letters and a little rundown about cPanel (I call it Cpanel error page for short). Here the very important thing is when I go to "somefakesub.domain.com" and if the redirection has not been defined for somefakesub.domain.com inside Cpanel then I get the Cpanel error page. In this case "somefakesub.domain.com" what I call a non-existing subdomain reference. So the subdomain redirection reference doesn't exist in Cpanel.

But when I define gadgets.domain.com in the subdomains redirection in Cpanel asking to go to example.com, it works very well, no Cpanel error page displayed, gadgets.domain.com goes to example.com. In this case this is what I call an existing subdomain reference. So the subdomain redirection reference exists in Cpanel.

So I am wondering why the Cpanel error page occures, because:

1. gadgets.domain.com can be found in root/public_html/gadgets and a .htaccess file in it with the rewrite code in the .htaccess file. So mod_rewrite definitely works, because it executes the rewrite code in the .htaccess file under root/public_html/gadgets.

2. but for somefakesub.domain.com, because there is no such directory like root/public_html/somefakesub as well as the .htaccess file in it, I thought that maybe the system would like to take the .htaccess file from root or maybe from root/public_html (I tried a .htacces file with rewrite code in root and in root/public_html, not working). However the system displays the Cpanel error page instead of executing .htaccess file in root and root/public_html, but the system definitely executes the .htaccess file with rewrite code in it under root/public_html/gadgets when calling gadgets.domain.com. This is like that, the Cpanel error page is annoying.

The other thing is that I can see only the existing (Cpanel user specified) subdomains in Cpanel. So I cannot deal with the non-existing subdomains in Cpanel, because these are the rest of the existing (Cpanel user specified) subdomains.

"Did you find any entries after all? Were you able to resolve the issue of the holding page?"

- No, I doubt it, Cpanel as a user interface cannot help me to fix this, it only provides the exisiting subdomain redirections which are working fine.

"In some builds of cPanel/WHM, there was a system in which their goal was to eliminate propagation times on new sub-domains by having a holding page for non-existing ones.

/scripts/upcp might fix it or there might be old entries like I said. Please let me know."

- You referred to /scripts/upcp. I don't know this, it can be a help. Can you tell me the details? Is it a directory structure from my root directory?

"PS: You might want to consider coming over to The Planet. They're great to host with! "

- Thank you, I can consider this possibility.


P.S.: Please don't mind if my description was too explanatory. I am not native English, and I didn't want to miss the point.
jimmybutcher
QUOTE (markcausa @ Mar 25 2007, 01:05 AM) *
Okay. I'm gonna admit I'm not quite sure what you're talking about but I think you mean this:
if you go to "somefakesub.domain.com" you see a green page with some orange letters and a little rundown about cPanel.

You should go into WHM > Edit DNS for that Domain and check down the list very carefully to see if those "non existent" subdomains have an entry or entries in there. They might have existed at one time and are still in there. It never hurts to delete old, unused entries anyway. wink.gif

If no such luck, try posted on the cPanel forums. They might be able to throw some more ideas at you.
PS: You might want to consider coming over to The Planet. They're great to host with! cool.gif



Regarding Cpanel forums I guess you mean http://forums.cpanel.net. I will try it, thank you!
markcausa
Sorry for not responding. Yes, that is what I mean. Many of the people on there are technicians for cPanel and some have torn apart cPanel like nobody's business, so they know exactly how it works.

You'll find me on there as well. smile.gif

PS: The Planet customers can call up support or file tickets regarding such situations.


Good luck. Please let us know what they say, so there is a reference for us in the future. cool.gif
jimmybutcher
"Please let us know what they say, so there is a reference for us in the future."

Unfortunately I don't have the answer. On the other hand my hosting company at least suggested using a virtual private server what they planned to integrate as a service in a short period. But Ultimately I switched to another hosting company who offered a promotional managed hosting solution, that was the solution for me.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.