Help required: CGI redirect to website index page?

Discussion in 'Site & Server Administration' started by kennymoo, Aug 29, 2011.

  1. #1
    Good afternoon,

    I have just purchased a domain. It has quite a few old URLs that I would really like to redirect to the sites index to prevent 404s.

    I'm fine redirecting normal pages with a .htaccess, but there is one troublesome URL that is really giving me a headache.

    The URL i want to redirect to the index is:

    /cgi-bin/pages.cgi?143205747

    I tried just redirecting the cgi-bin with the .htaccess but was still left with:

    /?143205747

    In honesty, that's no good for me, and isn't an improvement on the original URL.

    I'd be grateful of any help or advice to help me get the troublesome URL to redirect to my index.

    Thank you for reading my thread, I hope someone can help [​IMG]
     
    kennymoo, Aug 29, 2011 IP
  2. helpinghost

    helpinghost Active Member

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    53
    #2
    How about creating that pages.cgi file as a little perl script redirect i.e.:

    #!/usr/bin/perl

    use strict;
    use warnings;


    my $URL = "http://www.website.com/";

    print "Status: 302 Moved\nLocation: $URL\n\n";
     
    helpinghost, Aug 30, 2011 IP