GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Perl / CGI Question .. (https://gfy.com/showthread.php?t=349052)

Dcat 08-30-2004 05:24 PM

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 08-30-2004 05:25 PM

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

Libertine 08-30-2004 05:29 PM

A rewrite in your .htaccess should do the trick.

Dcat 08-30-2004 05:38 PM

Quote:

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

Dcat 08-30-2004 06:39 PM

bump

Dcat 08-31-2004 09:36 AM

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;

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

:thumbsup

raymor 08-31-2004 12:56 PM

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


All times are GMT -7. The time now is 12:38 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123