Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

MOD_Rewrite subdomains without the HTTPD.CONF wildcards?



4:14 am on Jan 17, 2004 (gmt 0)

10+ Year Member

Is it possible to set up a wildcard A at the registrar to avoid having to set wildcards in the httpd.conf, in order to avoid touching the HTTPD.CONF to set up subdomains?

Here is the situation. I want to create an unlimited number of "fake" subdomains. An easy way to think of it is like a search engine:

redirects to:

So that any user wanting to search any word can just type it in as the subdomain. In such a way, it would not be possible to actually set up all of these subdomain cases in mod_rewrite ... it would have to be a generic rule.

However, the condition is that I am not allowed to touch the HTTPD.CONF to point all wildcard domains to the document root.

So, I guess the basic question is, can I simply set up wildcard domain "A" record at my registrar, to effectively do the same thing without the need of changing the HTTPD.CONF?

I have tried numerous subdomain rewrite rules (for about two months now), many from threads such as these:


However, when I set up these rules as stated in the posts, the subdomain redirection gives me a 404. A check of my error log shows that nothing happened at all, which leaves me to believe that since the httpd.conf is not set up with wildcards the computer just doesn't know where to look for


Instead, it simply tells my ISP that such a domain doesn't exist and then it never even reaches my server in order to give even a 404.

Any help would be appreciated. I have been scratching my head over this since early NOV 2003 with no luck, and I've tried everything it seems. However I just am not so familiar with registrar records and such, so I have no idea how to proceed.

Take care all, and thanks in advance.


4:33 am on Jan 17, 2004 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member


Welcome to WebmasterWorld [webmasterworld.com]!

The problem has two parts:

1) First you have to get the HTTP requests routed to your "account" -- to your existing web root directory.

2) After you get that working, then you can redirect those requests which are for alternate subdomains to a subfolder based on the {HTTP_HOST} header information.

The first part concerns your DNS and your httpd.conf. Only the second part uses .htaccess. I'm afraid that given what you've told us, your hosting service does not allow subdomains, and has set up httpd.conf to reject all subdomain requests except "www" (To make the terminology clear, example.com is a domain; www.example.com and abc.example.com are subdomains of example.com). Therefore, since the requests are not reaching your web root directory, nothing you do in .htaccess can help.

Solution: Get a better host. :(



4:51 am on Jan 17, 2004 (gmt 0)

10+ Year Member

Actually, my host is very dedicated to helping me find a solution and he actually went out of his way to change the HTTPD.CONF to support wildcards at first - however, I asked him to remove this setting as I am specifically looking for a solution without touching the CONF. (My host must hate me by now, I bother him with the most obscure questions... :) But to his credit he helps me *always* for just my miniscule monthly hosting fee, and because he is too nice... <grin>)

Additionally, I tried it on a backup host with the same results.

So, your contention is that the HTTPD.CONF *must* be edited to support wildcards, and there is no way to do this instead at the registrar level without touching the HTTPD.CONF?


4:53 am on Jan 17, 2004 (gmt 0)

10+ Year Member

Additionally, subdomains are definately supported - I can set them up through the CPanel at the host. However this is a CONF edit, which again I am trying to avoid. I specifically set up a test subdomain to make sure it was possible, and it was...

Thanks again for any help Jim.


Featured Threads

Hot Threads This Week

Hot Threads This Month