Differences between PHP-redirect and forward

Source: Internet
Author: User

This may be a very simple thing. I have never learned it before, so now I can remember it when I saw it and decided to help.

Redirect redirection: After page a is processed, the server sends the response to the client, and then sends the request to page B from the client.
Forward forwarding: only redirection from page a to page B is performed on the server.

The difference is that the client requests page B.

The redirection request is sent twice. If there are many users, the user's 2nd requests will be placed at the end of the Request queue, and the user may wait for a long time. the transfer will not cause such problems.

So do we all use transfer? In other words, under what circumstances should I use forwarding and under what circumstances should I use redirection?

  1. Transfers are generally restricted to the same application.ProgramTo jump to an external website, you must use redirection.
  2. During the transfer process, the target page can use the request of the previous page, that is, the requests of the two pages, and the requests are merged, therefore, multiple actions can interact with each other (action is an action of the Controller in Zend ). we recommend that you use redirection if it is just a simple page Jump or you do not want to confuse page requests.

For the time being, there is only so much.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.