Forward Vs. Redirect

This is with respect to the Zend Framework (but the concepts pretty much apply to all web systems)


  1. 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
  2. If the ‘Reload’ button is hit after a forwarded request, the original request is sent (as url has not changed)
  3. Forwarding is always faster than a redirect


  1. The application instructs the browser to go to a second URL (browser address bar displays the new url)
  2. If the reload button is hit, the second URL is fetched
  3. 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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s