This is with respect to the Zend Framework (but the concepts pretty much apply to all web systems)
- The browser is unaware that a change of address has taken place. So, the URL remains the same. Note that if using PHP, the value of $_SERVER[REQUEST_URI] remains unchanged
- If the ‘Reload’ button is hit after a forwarded request, the original request is sent (as url has not changed)
- Forwarding is always faster than a redirect
- The application instructs the browser to go to a second URL (browser address bar displays the new url)
- If the reload button is hit, the second URL is fetched
- Contents of the buffer are flushed before a redirect
The Zend Framework has a cool action helper to help with redirects –’redirector’. Always use this instead of using the redirect command with relative paths embedded as parameters:
The controller parameter is optional – it defaults to the current controller if omitted.. Sweet!
Typically, if a database change is done, use ‘redirect’.
This is logical too.. After you do a database update operation and display a confirmation page to a user, you do not want a refresh to mess with the database again. So, use a redirect to display the result of a processing.