mod_perl and mod_rewrite can work together ?

2012-01-26 Thread Idel Fuschini
I've got this issue, in httpd.conf:

PerlTransHandler +Apache2::MyRedirect
RewriteRule ^/$ /home/index.html [R=301]

my mod_perl2 module in some condition need to redirect the browser to
another site. But my web server ignored my module.

This is the code:

 use Apache2::RequestRec ();
  use Apache2::RequestUtil ();
  use Apache2::SubRequest ();
  use Apache2::Log;
  use Apache2::Filter ();
  use APR::Table ();
  use LWP::Simple;
  use Apache2::Const -compile => qw(OK REDIRECT DECLINED);
sub handler{
my $f = shift;
my $return_value=Apache2::Const::DECLINED;
my $user_agent=lc($f->headers_in->{'User-Agent'}|| '');
if ($user_agent =~ m/iphone/i) {
$f->headers_out->set(Location => $location);
$f->status(Apache2::Const::REDIRECT);
$return_value=Apache2::Const::REDIRECT;
}
return $return_value;
  }

What is wrong, it's possible to do  ?

thanks
Idel
=
E-Mail: idel.fusch...@gmail.com
Web Site: http://www.idelfuschini.it
AMF project:  http://www.apachemobilefilter.org
AMF wiki: Apache Mobile Filter - http:/wiki.apachemobilefilter.org


Re: mod_perl and mod_rewrite can work together ?

2012-01-26 Thread Hibbard, Timothy
I do not use the httpd.conf to redirect instead I use the following code:


use Apache2::Const qw(HTTP_MOVED_TEMPORARILY);

$r->headers_out->add(Location => "http://someplace.come/index.html?iphone=yes";);
$r->status( HTTP_MOVED_TEMPORARILY);
return HTTP_MOVED_TEMPORARILY;

From: Idel Fuschini mailto:idel.fusch...@gmail.com>>
Date: Thu, 26 Jan 2012 07:02:09 -0500
To: modperl List mailto:modperl@perl.apache.org>>
Subject: mod_perl and mod_rewrite can work together ?

I've got this issue, in httpd.conf:

PerlTransHandler +Apache2::MyRedirect
RewriteRule ^/$ /home/index.html [R=301]

my mod_perl2 module in some condition need to redirect the browser to another 
site. But my web server ignored my module.

This is the code:

 use Apache2::RequestRec ();
  use Apache2::RequestUtil ();
  use Apache2::SubRequest ();
  use Apache2::Log;
  use Apache2::Filter ();
  use APR::Table ();
  use LWP::Simple;
  use Apache2::Const -compile => qw(OK REDIRECT DECLINED);
sub handler{
my $f = shift;
my $return_value=Apache2::Const::DECLINED;
my $user_agent=lc($f->headers_in->{'User-Agent'}|| '');
if ($user_agent =~ m/iphone/i) {
$f->headers_out->set(Location => $location);
$f->status(Apache2::Const::REDIRECT);
$return_value=Apache2::Const::REDIRECT;
}
return $return_value;
  }

What is wrong, it's possible to do  ?

thanks
Idel
=
E-Mail: idel.fusch...@gmail.com<mailto:idel.fusch...@gmail.com>
Web Site: http://www.idelfuschini.it
AMF project:  http://www.apachemobilefilter.org
AMF wiki: Apache Mobile Filter - 
http:/wiki.apachemobilefilter.org<http://wiki.apachemobilefilter.org>


Re: mod_perl and mod_rewrite can work together ?

2012-01-26 Thread Torsten Förtsch
On Thursday, 26 January 2012 13:02:09 Idel Fuschini wrote:
> $f->headers_out->set(Location => $location);

err_headers_out?

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net