Quoting Rasoul Hajikhani ([EMAIL PROTECTED]):
> Hello folks,
> I am trying to implement a simple PerlTransHandler to change:
>
> http://myserver/
>
> to
>
> http://myserver.rhythm.com/
>
> And here is my code:
>
> package MIS::GENERAL::FixURL;
>
> use Apache::Constants qw(DECLINED);
>
> use strict;
>
> sub handler
> {
> my $r = shift;
> my $uri = $r->uri;
>
> return DECLINED if ($uri =~ m/^.+\.rhythm\.com$/)
IIRC, the $r->uri method is normally not going yield the hostname or
scheme (unless this is a proxy request).
So for a request to http://www.rhythm.com/test/myfile.html
$r->uri is going to return only
/test/myfile.html
You may want to do some logging to verify.
Add
use Apache::Log ();
then inside your handler...
my $log = $r->server->log;
$log->debug("Processing request " . $r->uri);
Hope that helps.
>
> $uri =~ s/^(.+)/$1\.rhythm\.com/;
> $r->uri($uri);
>
> return DECLINED;
> }
>
> 1;
>
> Here is my https.conf entry:
> PerlTransHandler MIS::GENERAL::FixURL
>
> And here is my error when I type: s7.rhythm.com
>
> Invalid URI in request GET / HTTP/1.0
>
> But I get no error with: http://s7/
>
> Can some one tell me what am I doing wrong?
>
> Thanks in advance
> -r