Should I use a 301, 302, or 303 redirect after form submission?

Leo Galleguillos

I am creating a simple question-answer message board in php. When someone submits the answer to a question, the php script redirects the user to the original question, with the updated answer at the bottom of the page.

In this case, would it be better to use a 301, 302, or 303 redirect? I was thinking a 302 redirect because the redirect is not permanent or static – the redirect depends on parameters that are sent to the submission script. However, I have seen 303 recommended for some forms as well.

hifkanotiks

The correct redirect for this situation would be a 303 redirect, since you are redirecting from a form submission (presumably this would be a POST request) to a viewing page (which should be a GET request) and it is a temporary redirect (i.e. the redirect may change depending on parameters).

This is backed up by the standard:

The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

should I use 301 or 302 redirect for access control?

From Dev

Should I use redirect 301 for htaccess

From Dev

Use 301 or 303 to redirect http to https

From Dev

Change Umbraco 'redirect to' to use 301 instead of 302

From Dev

Change Umbraco 'redirect to' to use 301 instead of 302

From Dev

Redirect after AJAX form submission

From Dev

Cannot redirect after form submission

From Dev

redirect straight after form submission

From Dev

Redirect after AJAX form submission

From Dev

Redirect Url After Form Submission

From Dev

How can I get the First request url after 302 redirect 301

From Dev

Should I Use 301 or 302 If the New Location Is Changing Every Few Months

From Dev

Run PHP Code After Form Submission And Redirect

From Dev

RoR: form_tag, redirect after submission

From Dev

Not able to redirect a Django form after submission

From Dev

Laravel, how to redirect as 301 and 302

From Dev

301 or 302 redirect affecation in SEO

From Dev

I am getting a Cannot modify header information when trying to redirect a user after form submission

From Dev

301 Redirect to a 302 Redirect (SEO implications)

From Dev

How can I change the redirect method in Spring Security from 302 to 303?

From Dev

301 or 303 redirect in html meta tag?

From Dev

301 or 303 redirect in html meta tag?

From Dev

Should be a simple 301 redirect

From Dev

Django redirect to index view with correct URL after form submission

From Dev

get redirect_to and flash notices to work after ajax form submission

From Dev

How to redirect to new html page after form submission in Apps script

From Dev

Trigger a redirect to a page on form submission after three incorrect attempts in Javascript

From Dev

How to redirect with a 301 or 302 in the routes.rb

From Dev

How can I clear form values after successful form submission

Related Related

  1. 1

    should I use 301 or 302 redirect for access control?

  2. 2

    Should I use redirect 301 for htaccess

  3. 3

    Use 301 or 303 to redirect http to https

  4. 4

    Change Umbraco 'redirect to' to use 301 instead of 302

  5. 5

    Change Umbraco 'redirect to' to use 301 instead of 302

  6. 6

    Redirect after AJAX form submission

  7. 7

    Cannot redirect after form submission

  8. 8

    redirect straight after form submission

  9. 9

    Redirect after AJAX form submission

  10. 10

    Redirect Url After Form Submission

  11. 11

    How can I get the First request url after 302 redirect 301

  12. 12

    Should I Use 301 or 302 If the New Location Is Changing Every Few Months

  13. 13

    Run PHP Code After Form Submission And Redirect

  14. 14

    RoR: form_tag, redirect after submission

  15. 15

    Not able to redirect a Django form after submission

  16. 16

    Laravel, how to redirect as 301 and 302

  17. 17

    301 or 302 redirect affecation in SEO

  18. 18

    I am getting a Cannot modify header information when trying to redirect a user after form submission

  19. 19

    301 Redirect to a 302 Redirect (SEO implications)

  20. 20

    How can I change the redirect method in Spring Security from 302 to 303?

  21. 21

    301 or 303 redirect in html meta tag?

  22. 22

    301 or 303 redirect in html meta tag?

  23. 23

    Should be a simple 301 redirect

  24. 24

    Django redirect to index view with correct URL after form submission

  25. 25

    get redirect_to and flash notices to work after ajax form submission

  26. 26

    How to redirect to new html page after form submission in Apps script

  27. 27

    Trigger a redirect to a page on form submission after three incorrect attempts in Javascript

  28. 28

    How to redirect with a 301 or 302 in the routes.rb

  29. 29

    How can I clear form values after successful form submission

HotTag

Archive