Forum Moderators: phranque

Message Too Old, No Replies

Redirecting folder to cgi-folder

         

logic0

3:06 pm on Jan 3, 2008 (gmt 0)

10+ Year Member



I have cgi configured in my webserver.. [mydomain.com...] and test.pl is configured to show results like host details,http_cookie and so on and it works fine.. hitting above url directly.

Using mod-rewrite i am trying to redirect following
[mydomain.com...] to above page.

HTTPD Congfiguration as below

RewriteEngine on
RewriteCond %{HTTP_HOST} (www.mydomain.com)
RewriteRule ^/redirect/index.html /cgi-bin/test.pl [L]

Problem :

Redirect is working .. when i say [mydomain.com...] , i am gettn redirected to [mydomain.com...] But instead of showing values like host details,http_cookie and so on . It shows me the test.pl code directly in page...

Am i missing something..?

jdMorgan

5:19 pm on Jan 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like the script is not outputting the "Content-Type" server response header to identify the MIME-type of its output as text/html (or text/plain).

PERL:


print "Content-type: text/html\n\n";

The line above must be placed before any other directives in the script that generate output to "the page."

You can use the "Live HTTP Headers" add-on for Firefox or other Mozilla-based browsers to verify this.

Jim

logic0

1:09 pm on Jan 4, 2008 (gmt 0)

10+ Year Member



Using tamper data in mozilla.. I can see the headers as below...

when i hit [mydomain.com...] , i can see response headers as content type :text/html

but when its redirected from [mydomain.com...] , i see response headers as content type : text/plain

Could this be an issue? is there anyway we can force redirect to serve content type: text/html?

phranque

1:45 pm on Jan 4, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



it appears it doesn't recognize your script as a cgi script.
try renaming your script to test.cgi and change your rewriterule to go there.

logic0

2:09 pm on Jan 4, 2008 (gmt 0)

10+ Year Member



thanks phranque... i got it..

My .pl was not get recognized after it was redirected..

So i fixed it by adding it to AddHandler

AddHandler cgi-script .cgi .pl