Perl / CGI Question ..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dcat
    Confirmed User
    • Aug 2003
    • 1607

    #1

    Perl / CGI Question ..

    Can you help me out?

    I'm replacing a Top Sites script on my server from ?Top Sites Pro? (Coded in Perl) to ?Auto Rank PHP? (Coded in PHP), and I need to know how to redirect all existing incoming links to the new script.


    The old (incoming) links look like:

    http://www.site.com/cgi-bin/topsites.cgi?accountx


    New site links need to look like:

    http://www.site.com/in.php?id=accountx


    I need to know what code to put into the "topsites.cgi" file to make the old accounts redirect to the new link.

    How would I do this?
  • WiredGuy
    Pounding Googlebot
    • Aug 2002
    • 34512

    #2
    You could create a permanent redirect at the server (apache) level to do this for you so no change need to be made to scripts or existing partners.

    WG
    I play with Google.

    Comment

    • Libertine
      sex dwarf
      • May 2002
      • 17860

      #3
      A rewrite in your .htaccess should do the trick.
      /(bb|[^b]{2})/

      Comment

      • Dcat
        Confirmed User
        • Aug 2003
        • 1607

        #4
        Originally posted by punkworld
        A rewrite in your .htaccess should do the trick.
        Thanks, but what exactly do I add to my .htaccess file?

        Comment

        • Dcat
          Confirmed User
          • Aug 2003
          • 1607

          #5
          bump

          Comment

          • Dcat
            Confirmed User
            • Aug 2003
            • 1607

            #6
            In case anyone else was interested in how to do this, I came up with this code. It performs the account substitution nicely, and seems to work well.

            * Note: I placed this code into my old "topsites.cgi" file.


            ---------------------------------------------------
            #!/usr/bin/perl

            use CGI qw(:standard);

            my $id = param('id');

            print "Location: http://www.mysite.com/in.php?id=$id\n\n";
            print ("Content-type: text/html\n\n");
            exit;

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

            Comment

            • raymor
              Confirmed User
              • Oct 2002
              • 3745

              #7
              This is untested "air code".
              $25 will have it installed and tested on your server.

              RewriteEngine On
              RewriteRule /cgi-bin/topsites.cgi?(.*) /in.php?id=$1
              For historical display only. This information is not current:
              support@bettercgi.com ICQ 7208627
              Strongbox - The next generation in site security
              Throttlebox - The next generation in bandwidth control
              Clonebox - Backup and disaster recovery on steroids

              Comment

              Working...