SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just curious, is there a script somewhere that will allow you to put a subdomain on your site in the form of "yourname.yourcompany.com" ?

    Sparkie

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    name the following index.cgi and put it in your root directory
    -------------------

    #!/usr/bin/perl

    require "index.conf";

    print "Location:$URLRedirector
    Content-type:text/html\n\n";
    print <<END;
    <HTML>
    <HEAD>
    <TITLE>$ENV{'HTTP_HOST'}</TITLE>
    <META HTTP-EQUIV="Refresh" Content=0;URL="$URLRedirector">
    </HEAD>
    <BODY>
    </BODY>
    </HTML>
    END
    ;
    ------------------


    name the following index.conf and put it in your root directory

    -------------

    # Don't change this variable
    $URLRedirector="";


    if ($ENV{'HTTP_HOST'} eq 'yourname.yourcompany.com') {$URLRedirector="/yourname/index.html"}

    if ($ENV{'HTTP_HOST'} eq 'theirname.yourcompay.com'){$URLRedirector="/theirname/index.htm"}

    # the default homepage.
    if ($URLRedirector eq "") {$URLRedirector="index2.html"}

    1;

    ----------

    premissions on .cgi should be

    rwxrwxr_x

    on .conf

    rw_rw_r__

    Hope that helps, and remember to upload is ascii.

    Chris


    [This message has been edited by aspen (edited June 27, 2000).]

  3. #3
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And what parts of that can I modify?

    I dont have a grand and expansive knowledge of CGI/Perl (yet!) so that went a bit over my head I really appreciate the detailed explanation though! I'm sure if I dabble in it a bit more, it will get easier, hehehe

    Sparkie

    [This message has been edited by Sparkie (edited June 27, 2000).]

  4. #4
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you modify is the following:


    if ($ENV{'HTTP_HOST'} eq 'yourname.yourcompany.com') {$URLRedirector="/yourname/index.html"}

    You can add as many of these as you want, just type in what the domain would be and then type in the path to the file you want server when that address is requested.

    Also you can't have an index.html file in your root directory, the servers need to serve index.cgi as the default, who you could set if it your own server, or if you get in contact with your hosting company. But if you dont have any index.html pages it should default to index.cgi anyways.

    Chris


  5. #5
    SitePoint Enthusiast Vpekulas's Avatar
    Join Date
    Mar 2000
    Location
    Winnipeg, Canada
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's a great code, but it has very little in common with subdomains. It's just a redirection from 404 to whatever you select.
    (404 by default)

  6. #6
    Skills to Pay the Bills Sparkie's Avatar
    Join Date
    Jul 1999
    Location
    A cave with 47 computers and an internet feed
    Posts
    3,559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any other suggestions?

  7. #7
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Check out CGI Resources. They have several scripts that do the kind of redirection your looking for in their PERL section.

    ------------------
    Wayne Luke - Sitepoint Forums Administrator
    Digital Magician Studios - Making Magic with Web Applications
    wluke@digitalmagician.com


Bookmarks

Posting Permissions

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