Complicated DNS and hostname Setup Questions


I want to setup my domain like this:


Obviously I have to control “” but this is just an example.

I see how to make the first subdomain “” and am guessing to make “” is the same way.

The problem is that I want to do this via a script. For example I want to generate a list of every state and place that in a cut and paste field or even a script via the shell. It takes too long to click 50 time for each state and I plan on doing this for several different keywords.

Any ideas or suggestions?

Here are some things to keep the solutions more geared to what I actually need:

  1. Wildcard domains will not work. I need each to point to matching directories on the file server.

Example: needs to resolve to the files located on server in this location:

wildcard makes everything point to the same directory, so everything would go to:
/home/user/ which is not what I want.

I realize that if someone hits: it will show the files so I may need a solution to prevent that. (for now it doesn’t matter)

I’ve tried mod_rewrite but dreamhost said I had to figure it out on my own, and after several days of not understanding why I was getting 500 errors (I asked for the mod_rewrite log to see, but was told to figure it out on my own), I gave up.

This would be simple if I could use wildcards and then a script to redirect based on the domain and subdomain words. I just can’t figure that out.

So, is there a way to set this up via script or “all at once”?

  1. CGI parameters like : will not work, that’s not the solution I want.

So if I can’t do a cgi parameter solution, mod_rewrite solution ( it uses .htaccess ), or a script to setup all at once, any suggestions on what I can do to get this structure setup without having to manually set each one up via the control panel?

Thank you in advance.


You can complete tasks that are normally done through the panel via a script. However, the script must authenticate it self and submit the information to the panel. There is no other way to do such things with out going through the panel by some means. So you’d have to set your script up to log into the panel, and submit the informaitno you want, in the same manner as the stuff submits from the panel.

This has come up a few times before, you should be able to search the forums and find some of the other posts - though I don’t think there’s a lot of information on the subject. One or two of the topics have been about creating E-mails onthe fly for site users.

–Matttail - personal website


Thank you. Any ideas or keywords I could look up? Not sure how the script would authenticate unless I used something like LWP and faked a browser session.


update: I started to write a perl script using LWP, but quickly backed off that. THere are some automation scripts that are very easy to use. One is called Autoit, it’s free. I’m writing a script now that is working so far that uses the autoit engine. I’ll post a wiki link once it’s done. Thanks for the pointer.


here’s one helpful post:
click here

I really thought there was an other, but I’m not finding it. Something about letting visitors create E-mail addresses through their site.

–Matttail - personal website