Inexistence has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
Ok, i'm sure i'm just having a brain fart OR its simply not possible to do what i'm trying. The redirect simply doesn't happen with either IE9, Google Chrome or FireFox. So I suspect its a limitation that a page can't redirect?
I'm trying to redirect to index.shtml if the user requests the welcome page without being authorized first. The same redirect method works when delivered from a perl script directly
My welcomeV01.pl simply contains this:
my $URL = "http://localhost/index.shtml"; print "Status: 302 Found\n"; print "Location: $URL\n\n"; exit;
My welcome.shtml page simply contains this:
<!--#include virtual="/cgi-bin/welcomeV01.pl"-->Thank-you kindly in advance :) *bow*
(Apache server, no errors in logs, perl is functional as i'm using it for other scripts on the same server)
SOLUTION: After a couple hours of searching google for more info on methods of accomplishing this, the idea popped into my head to use .htaccess ModRewrite to redirect all calls to welcome.shtml, directly to the welcome.pl script instead. It is working thus far, allowing me to supply content based on the client being authorized
Necessary .htaccess file changes: RewriteEngine on RewriteRule welcome.shtml /cgi-bin/welcomeV01.pl [L] Perl file code: my $URL = "http://localhost/index.shtml"; print "Status: 302 Found\n"; print "Location: $URL\r\n\r\n"; exit;
Thank-you very much for your help Monks, asking the questions here allowed me to break my thought cycle and move forward
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTTP Redirect from SHTML page
by Anonymous Monk on Oct 24, 2011 at 06:27 UTC | |
by Inexistence (Acolyte) on Oct 24, 2011 at 06:56 UTC | |
by Anonymous Monk on Oct 24, 2011 at 10:04 UTC | |
by Inexistence (Acolyte) on Oct 24, 2011 at 15:06 UTC | |
|
Re: HTTP Redirect from SHTML page
by Anonymous Monk on Oct 24, 2011 at 06:02 UTC | |
by Inexistence (Acolyte) on Oct 24, 2011 at 06:14 UTC |