Helpful Information
 
 
Category: Apache
Apache -> VirtualHosts -> Redirect Problem

I'm using Apache 2.0.52 with PHP 5.0.3 on a Windows 2003 standard server on a dedicated machine. I'm having some issues trying to setup the Apache Virtualhosts to call a wildcard and point it to whatever the wildcard is for a php file. I know I may have just butchered what I'm asking for here, but let me try to explain a little clearer :P (It's so early in the morning here. -cries-).

Let's say I'm attempting to use variable.domain.com as my virtual host (subdomain even.)

When variable.domain.com is called, the "variable" should be transferred to the address of whatever the PHP file is + the variable string calling whatever in the PHP itself.

variable.domain.com points to http://www.domain.com/index.php?variable=$variable, for instance.



Now that I've kinda explained what I'm doing here, let me finally get to the problem -- :disappointed:

When an address is typed in the location bar of the browser including the subdomain, the address simply isn't found (I'm using Firefox.) I don't get a 404 or anything. It just dies.


My question is -- should something be in the Windows "hosts" file that I'm missing or should something be setup in the Apache httpd.conf or .htaccess files a little differently? Currently, I have not touched the "hosts" file (which, from what I've read on other websites.. this -would- be the problem.. but I'm just trying to make sure here.) Am I being a total klutz somewhere along the lines of setting this up? Has anyone else had a similiar problem and care to share the experience?

Can anyone give me an example of their own setup or a resource to get a little help? If anyone has any questions in regards to what I'm trying to do -- please don't hesitate to ask. I'm just a little stumped and not exactly sure where to turn seeing as this is my second time setting up Adobe and first time playing with the virtual hosts configuration.

Thanks much.

You need to make sure you have a star entry in your domain registration so that all subdomains are directed to your webserver. If you only have a www record, only the www subdomain will make its way to your server.

WetWired is right. You need wildcard DNS enabled on your host :) i did the same thing last month.

Thanks for replying guys. The reason I wasn't able to say thanks sooner is because I was trying to confirm with my domain provider whether or not the wildcard was available. I had a suspicion my problem didn't lie with what I was doing (in the direction both of you were pointing at) but rather with the domain itself. Sure enough, I contacted the domain provider and was told, indeed, subdomain wildcards cannot be used on their service, only www. and no subdomain are allowed (domainname.com) and I don't have the access to change it, nor will they give that information to me. ;) So off to the races in finding a domain provider that does allow it and gives me the opportunity to change the information around when I require.

Thanks again. :)

*** EDIT ****


Everything is working fine for the most part guys. Thanks. ^.^

---

But, here's a little more I seem to be having problems with:

I don't know if it's any more complex than above, but it certainly doesn't seem to be. The only problem left with this is the fact I'm probably bugging the lot of you. ;) Well, no, there's something else to it --

I'm having a small problem trying to pull something off in the Apache Virtualhosts. The wildcard works -perfect- -- it redirects to the assigned page as it should with the wildcard string to put something I've assigned to the php file in motion. That's great.

However, I'm attempting to take the same principle -- wildcard.domain.com -- and place a directory after it /without/ showing any of the URL as having the ?xx=wildcard information showing.

Example of how things show currently:

User types: http://blah.domain.com/directory
Apache outputs: http://blah.domain.com/directory/?xx=blah


Any way to take away the ?xx=blah?

The current <VirtualHost> setup I have is something like the following outline, roughly displayed below:


<Virtualhost ..>
..
..
DocumentRoot "rootdirectory"

<Directory "rootdirectory">
..
..
RewriteEngine On
RewriteCond ..
..
RewriteRule ..
</Directory>

<Directory "rootdirectory/directory">
..
..
RewriteEngine On
RewriteCond ..
..
RewriteRule ..
</Directory>
</Virtualhost>


Of course I can provide a better detail, I was just offering a rough sketch. I am using the [P, L] values, btw.