dipit has asked for the wisdom of the Perl Monks concerning the following question:

i am facing issue in redirecting a webpage. I want to redirect to only particular page everytime after login nonetheless of which action is mentioned in URL bar. I am trying to achieve this by doing changes in .htaccess but unable to do so! here is my .htaccess file in which i have added Redirect code.

AuthName "Dear User, There is restricted area! Use your ID and well-kn +own password to enter" AuthType Basic AuthUserFile /var/URTAuthTest require valid-user Redirect 301 /tools/id/gel444/controller "http://9.111.111.111/tools/i +d/gel444/controller?action=homeacceptableuse"

I am getting following error in firefox :

The page isn’t redirecting properly Firefox has detected that the server is redirecting the request for th +is address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accep +t cookies.

Replies are listed 'Best First'.
Re: [OT] Need help in redirecting WebPage in FastCGI-Perl Application via .htaccess
by Corion (Patriarch) on Nov 25, 2019 at 17:50 UTC

    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$ ?

      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.