Good practice for redirecting pages?

I remember reading some good practice of redirecting pages using GET somewhere to show the next page after a POST request. Why is this so?

+6
redirect php
source share
5 answers

Thus, if the user reloads the page, the browser will not send another POST.

For example, if the page is an order confirmation page, you do not want the order to be repeated if the user refreshes the page.

+12
source share

This is because if the user submits the form and goes to the thank you page, it refreshes this page, the browser asks the user to resubmit the form, thereby creating two messages for your data handler. If you redirect a thank you page using GET, post vars are empty, so the form will not be resubmitted.

I'm not sure that it is still considered good practice - this time I have not heard anything.

+1
source share

GET is idempotent, and POST is not. If the user reloads the page (or returns there by clicking the "Back in the browser" button), nothing will break.

0
source share

I would suggest that it is so that the next page is bookmarked.

-2
source share

If you cannot remember why this is good practice, there may be no good excuse for this.

IMHO, this is the case of swings and roundabouts - and, of course, it's easy to argue about the opposite - whether it's its good practice or not entirely dependent on how it fits into the rest of your code.

FROM.

-4
source share

All Articles