in reply to Re: [OT] Need help in redirecting WebPage in FastCGI-Perl Application via .htaccess
in thread [OT] Need help in redirecting WebPage in FastCGI-Perl Application via .htaccess

Yea, if i add anything such as "/" or "$" at the end of "tools/id/gel444/controller", it will not redirect me to the mentioned location in .htaccess. But it will take me to the page which has been mentioned in URL bar only which is not required. Yes, my webserver is at same location. I want to switch to pages in between same domain and that too only first time after logging in.

  • Comment on Re^2: [OT] Need help in redirecting WebPage in FastCGI-Perl Application via .htaccess

Replies are listed 'Best First'.
Re^3: [OT] Need help in redirecting WebPage in FastCGI-Perl Application via .htaccess
by hippo (Archbishop) on Nov 25, 2019 at 22:42 UTC
    only first time after logging in

    For that you will need some means of maintaining state. I suggest setting a session cookie.

      So, it means first redirection after login can't be achieved with .htaccess? Why i am asking because i have never used this concept before and thus don't have much experience with apache configurations. In my tool, CGISESSID cookie is being used. I tried adding "domain" in this but it din't work and i am also not sure how will it work. Can you please help me with other suggestions which i can implement?

      my $cookie = CGI::Cookie->new( -name => 'CGISESSID', -value => $self->session->id(), #-domain => 'http://9.111.111.111/tools/id/gel444/controller? +action=homeacceptableuse', -secure => 1, -HttpOnly => 1 );
        I tried adding "domain" in this but it din't work

        http://9.111.111.111/tools/id/gel444/controller?action=homeacceptableuse is not a domain so it's not surprising that it doesn't work. Another problem is that you've specified -secure => 1 when the URL in question is clearly not secure.

        Can you please help me with other suggestions which i can implement?

        One typical approach to achieve your desired feature is:

        1. Any client without the cookie is redirected to the page.
        2. The page requires auth.
        3. The page then sets the cookie so the client won't be sent back to it during the same session.

        You can work on implementing each of these independently until you have the full working solution.