Re: General use of rewrite / redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 18, 2008 at 9:22 PM, Aschwin Wesselius <aschwin@xxxxxxxxxxxxxx>
wrote:

> Per Jessen wrote:
> > Yes, that's a very typical setup.  When the form is processed, you send
> > a 303 redirect to the "Thank you" page.  That way, if the user hits
> > the "back" arrow, he's taken back to the form URL, not the post URL.
> > (which would then warn him about re-submitting etc.)
> >
> Ok, fine. But why do a real redirect when a header with 303 could be
> sufficient? If you model good enough, there would not be a need for
> header(location) redirects. Or am I wrong?
> >> What is your opinion about (ab)using rewrites / redirects? Do you use
> >> it quick and dirty, or is it some elegant way of controlling flow?
> >>
> > I think there are plenty of perfectly valid reasons for using a
> > redirect, whether dynamically from php or via an apache config.
> > And undoubtedly there equally many poor reason for using redirect and/or
> > rewrite.  (they're very different things, by the way).
> I know they're different things. I only want to start a discussion so
> people do understand other techniques instead of just using whatever
> 'works' as a solution to their problem with flow. Redirects do solve
> some issues, but they should be avoided whenever possible.
>
> header(location) mechanisms do come with a very huge disadvantage if you
> don't use them with caution. Requests are reinitialised, libraries
> loaded (again), DB connections setup/checked again, session lookups are
> being done, log write for another request etc. That's quite an impact
> for just not knowing what to do with flow. So, if you know what you want
> to handle (control) and what you want the user to see (view), one should
> be able to model it without the use of redirects unless it really is
> needed.
>
> Or is it OK, to redirect and 'simplify' the flow?
> --
>
> Aschwin Wesselius
>
> /'What you would like to be done to you, do that to the other....'/
>
>
i am sorry.. but i don't get what u really want to say. honestly, i don't
see any other way
(better alternative) to avoid people to simply refresh the browser to submit
the form
many time.

>Requests are reinitialised, libraries
>loaded (again), DB connections setup/checked again, session lookups are
>being done, log write for another request etc.

i don't see anything wrong with this since that is the way it is. whether
you redirect or
not, the script will do DB connection, session lookup anyway. i simply
called exit;
to stop execution after the header redirect..

sorry.. if i misunderstand your point. but that is just my opinion..

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux