Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

redirect encrypted cgi pages

We are going to switch from cgi pages to php pages. So we want to redirect the google indexed cgi pages to our new pages. We tried .htaccess redirect but it doesn't work with cgi files. Plus our cgi pages are encrypted.

Old page: http://www.mysite.com/cgi-bin/page.cgi?a=info.html&b=2003
New page: http://www.mynewsite.com/2003/

Any suggestions how to get redirecting work for these encrypted pages?
0
trailerman
Asked:
trailerman
  • 3
  • 2
1 Solution
 
bersekenCommented:
at the top of your script this would do it:

my $cgi = CGI->new();
my $year = $cgi->param("b");
print $cgi->redirect("http://www.mynewsite.com/$year/");

0
 
trailermanAuthor Commented:
the cgi page is encrypted. Is it okay to add the script on top?
0
 
bersekenCommented:
I am not sure what you mean when you say that the cgi page is encrypted. Do you mean that it is accessed via https?

If you edit the script and there is a line at the top that looks like this:
#!/usr/bin/perl

then just put the code I provided on the next line.
0
 
trailermanAuthor Commented:
you don't see the regular perl codes on the page but all 'weird' characters because the pages are encrypted.

Is there a way to go around these encrypted pages?

0
 
bersekenCommented:
Actually the easiest way is to just move that 'encrypted' perl script out of the way and replace it with a script which has the same name that contains this:

#!/usr/bin/perl
use CGI;
my $cgi = CGI->new();
my $year = $cgi->param("b");
print $cgi->redirect("http://www.mynewsite.com/$year/");
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now