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

So, have you looked at the network traffic (and/or webserver logs) to see how exactly your redirect keeps looping?

My guess is that your rule matches your redirected location:

Redirect 301 /tools/id/gel444/controller "http://9.111.111.111/tools/i +d/gel444/controller?action=homeacceptableuse"

If your webserver is at http://9.111.111.111/, then the above will always redirect (I guess), with or without the additional parameter.

Maybe adding something to the end of the match makes things work? /tools/id/gel444/controller$ ?

Replies are listed 'Best First'.
Re^2: [OT] Need help in redirecting WebPage in FastCGI-Perl Application via .htaccess
by dipit (Sexton) on Nov 25, 2019 at 18:04 UTC

    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.

      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 );