[CPANEL] How Do I Redirect Unused Subdomains to a special page?

StealthDesign

New member
How Do I Redirect Unused Subdomains to a special page? I am on a CPANEL based virtual hosting environment.


For example I have the site:

http://systemspecs.com

And I have the following subdomains:

http://usmc.systemspecs.com
http://darkclanofdeath.systemspecs.com

Now how would I redirect all other (unused) subdomains (*.systemspecs.com) to a specific default url? Right now they go to an Apache "Hey, it worked !" page, which is not exactly what I want my visitors to see.


Thanks in advance,
Roy
 
What you're after is wildcard dns, which has been apparently setup on your system. This isn't exactly the best way to handle dns however, especially with a control panel such as cpanel which controls dns for you rather well. Wildcard dns can cause problems when dealing with CPanel. Since you've got it (partially) setup, here's the rest of what you need to do (it's really not hard).

Go into httpd.conf (for cpanel servers it's in /usr/local/apache/conf/httpd.conf),
Find the entry for your domain. Cut and paste all other entries for this specific domain right under that, so you don't interfere with anything.
Make a seperate entry, name it *.domain.com, point it where you want it to go.
Save httpd.conf
Restart httpd (/etc/init.d/httpd stop;/etc/init.d/httpd start).

Once you've done this you should be good to go with apache and wildcard dns.
 
sorry for jumping this thread
i really need help in this subjerct and i didnt want to open a new thread...

ok i wanna make some kind of a subdomains redirecting system.
i have a main domain www.signup.co.il

and i need something to redirect all unfound domains to a certain PHP page that will check the prefix of the subdomain and by that will redirect the user to a followin page ...

how can i make a file that will "Catch" all unworking subdomains?

i dont have access to my httpd.conf ... maybe i can get access but i really doubt that...

is there a way to maybe do it with .htaccess?...

sorry if my english is weird, im from Israel.

hope you can help me.
greetings,
shai.
 
Top