Forum Moderators: phranque
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:
searchkeyword.mygoogle.com
redirects to:
www.mygoogle.com/search.php?keyword=searchkeyword
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:
[webmasterworld.com...]
[webmasterworld.com...]
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
searchkeyword.mygoogle.com
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.
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. :(
Jim
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?