Results 1 to 3 of 3

Thread: Redirect browser to local file

  1. #1
    Join Date
    May 2005

    Redirect browser to local file

    I'm just learning PERL. I installed ActivePerl on my win computer and run TinyWeb server. I wrote a little "Hello, World!" script that responds properly when I access it with my browser. It's called index.pl and it prints all the html code out to the browser so this works.

    What I would like to try is have index.pl redirect to a local .html file. When I try this I get a "403 Forbidden" error. This is what I wrote:

    #!/usr/local/bin/perl -w
    use strict;
    my $URL="http://localhost/mytest.html";
    print "Location: $URL\n\n";
    I also just used print "Location: mytest.html";

    I've put the .html file in the same folder as the .pl file as well as the root folder but I always get the same error. I can access the file by using localhost/mytest.html

  2. #2
    Join Date
    May 2005
    I have some reading still to do but it seems my file should have been named index.cgi. Changing the name made it work but why didn't index.pl?

  3. #3
    Join Date
    May 2005
    This is craaazzzy, man. Now index.pl works just fine and redirects to mytest.html. I don't know what I did but it's working now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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