You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Charrick, Gordon" <go...@tfn.com> on 2003/05/01 15:49:48 UTC

RE: [users@httpd] Redirect help in 1.3.xx

Thanks for the help but the developer ended up doing the redirect in the
code. It was the cleanest way to go.


-----Original Message-----
From: James.B.Muir@Hitchcock.ORG [mailto:James.B.Muir@Hitchcock.ORG]
Sent: Wednesday, April 30, 2003 4:37 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Redirect help in 1.3.xx


One way would be to use an Apache module (via PerlTransHandler directive),
assuming your Apache has mod_perl.
This is not a slam dunk though, since it means you have to write a handler
in perl to do the redirect based on the request uri.

The directive in httpd.conf is:

PerlTransHandler Apache::TransURI

Here's a bit of code for your TransURI.pm (or whatever you want to call it)
to start with:

# TransURI.pm: Translate URI's as appropriate.
#
# This is a mod_perl URI translation handler for the Apache webserver.
#
package Apache::TransURI;

use Apache::Constants qw(:common);
use Apache::Log;


sub handler 
{
    my $r     = shift(@_);                             # Get request object.

    my $uri   = $r->uri;                               # Get the URI string.

# -------------------------------------------------- "/ABCDEFG" request.

    if ($uri =~ m/^\/ABCDEFG$/io)
    {
	$r->internal_redirect("/some/other/page.html");

	return DONE;
    }

    return DECLINED;
}


1;


You may also need a PerlSetEnv directive in httpd.conf to tell Apache where
you put your module:

PerlSetEnv PERL5LIB /path/to/your/apache/modules/directory

Good luck.
-James

--- You wrote:
I've got to get this done quickly and haven't been able to figure out how to
do it myself yet so I'm asking the list for some help.

We're using Weblogic with apache as a frontend. We have apache (1.3.27) set
up so any url that looks like http://abc.com/application/anythingelsehere is
forwarded to Weblogic for processing because it specifically looks for the
"application" string. What I need to do is redirect any url that looks like
http://abc.com/application/anythinghere/ABCDEFG/anythingelse to a static
splash page at http://abc.com/splash. 

Somehow, I need to have apache pass everything with "application" in it to
Weblogic unless it also has ABCDEFG in the url. I've played around some with
LocationMatch and RedirectMatch but haven't been able to figure it out.
Ideas anyone?

Gordon

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
--- end of quote ---


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org