Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Posts
    58

    Bind a subdomain to a file

    I'm trying to bind a subdomain to a file on Apache... I've had this in my virtual host for a while and it does the job:
    Code:
    DocumentRoot c:/path/to/file/file.php/
    But aparently this isn't a good thing to do, since lately it chrashes Apache.
    I've been breaking my head over this problem a couple of days now and the best solution would seem mod_rewrite, but I just can't get a working rewriterule.
    The PHP script uses $REQUEST_URI and all requests on that subdomain should be passed on to the script, like:
    sub.domain.com/
    sub.domain.com/file.htm
    sub.domain.com/folder/
    sub.domain.com/http://somedifferentsite.com

    So sub.domain.com[/whatever] needs to become sub.domain.com/file.php[/whatever]

    Can anybody help me out?
    Last edited by Thanatos; 11-18-2002 at 04:44 PM.

  2. #2
    Join Date
    Jun 2002
    Posts
    1,376
    This is somewhat of a shot in the dark, but I noticed you have a slash on the end -- in theory, it would be looking for a directory (not a file) called "file.php". You may also want quotes around it. (I'm curious as to why it has all of a sudden started crashing -- have you changed something?)

    I can't help you with modRewrite, although I'm pretty sure what you're doing is possible (and pretty common, I believe).

  3. #3
    Join Date
    Oct 2002
    Posts
    58
    Thank you... the / was actually a typo (stupid to make a typo in config-quote). But I tried putting quotes around the location and the server hasn't crashed yet . When I let Apache test the config I still get this message (same as before):
    Code:
    Warning: DocumentRoot [c:/www/domain/redirect/redirect.php] does
    not exist
    c:/www/apache/conf/httpd.conf: Syntax OK
    I haven't made any significant changes to to config lately. The only thing I did is put a rewriterule in an .htaccess on a whole different subdomain.

    I'll let you know how it works out, but for now; thank you.

  4. #4
    Join Date
    Jun 2002
    Posts
    1,376
    Code:
    Warning: DocumentRoot [c:/www/domain/redirect/redirect.php] does
    not exist
    c:/www/apache/conf/httpd.conf: Syntax OK
    Oh... The DocumentRoot is supposed to be a directory. So you'd want to set it to like C:/www/domain/redirect/, but then index.php is the first file it would load -- you could make another directory and set that as your docroot, or you could just rename redirect.php to index.php.

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •