I think you need to do a redirect. From within your mod_perl handler try 
something like this:

    $r->content_type("text/plain");

    $r->headers_out->set(Location=>$url);

    return Apache2::Const::HTTP_TEMPORARY_REDIRECT;


From: Jerry Pereira [mailto:online.je...@gmail.com]
Sent: Monday, July 11, 2011 2:48 PM
To: modperl@perl.apache.org
Subject: Changing browser URL based on condition


Hi All,

I would like to know if there is a way to change the URL displayed on
browser without using Redirect option. The URL visible on client browser
must be based on some condition that is evaluated in my mod_perl handler.

For example -

1. User types the URL - www.example.com<http://www.example.com/>, this will 
display the login page.
2. Once the user enters the credentials and hits submit, the request is
posted to www.example.com/login<http://www.example.com/login> action.
3. If the credentials entered by the user is valid then i would like to show
the home page..uri
4. I am able to show the homw page, but the URL does not change to
www.example.com/home<http://www.example.com/home>, instead it remains the same 
(i.e.
www.example.com/login<http://www.example.com/login>). I am using Template 
toolkit to render my pages. I
tried $req->url('/home'), but that does not change the browser URI.

Any help will be appreciated.

Thanks,
Jerry

IMPORTANT NOTICE REGARDING THIS ELECTRONIC MESSAGE:

This message is intended for the use of the person to whom it is addressed and 
may contain information that is privileged, confidential, and protected from 
disclosure under applicable law. If you are not the intended recipient, your 
use of this message for any purpose is strictly prohibited. If you have 
received this communication in error, please delete the message and notify the 
sender so that we may correct our records.

Reply via email to