Index Ai Academy
Glossary · Phase 8 · APIs

Post/redirect/get

Answering a successful form submission with a redirect instead of a page, so reloading repeats a harmless GET rather than sending the form again.

Suppose a successful POST answered with a normal page saying "Report saved". If the person presses reload, the browser asks "Send the form again?", and one click saves a duplicate report, or pays twice. The fix is a pattern called post/redirect/get: after a successful POST, answer with a redirect, and let the browser fetch the result page with a fresh GET. Reloading then repeats only the harmless GET.

Try it now

Only the final GET is repeated by a reload, so nothing is saved twice.

Learn it properly

Forms and redirects · GET and POST, validation messages, post/redirect/get, flash messages and CSRF tokens. About 45 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write