John Davidson

redirect - Can php redirection fail according to browser?


I wonder if a PHP redirection (header('location:'); die();) is 100% reliable or according to the client's browser, the redirection may fail?

I'm asking this question, because we sometime see a message like:

If your are not redirected in 10 seconds, click here

EDIT: should I display this kind of message for a PHP redirection?

My Answer:
PHP redirection using the header() function is generally reliable and should work across different browsers. However, there are some scenarios where the redirection may fail, such as if the headers have already been sent or if there are issues with the server configuration.

Displaying a message like "If you are not redirected in 10 seconds, click here" is a good practice as it provides a fallback option for users in case the redirection does not work for some reason. It gives users the option to manually navigate to the desired page if the automatic redirection fails.

Rate this post

3 of 5 based on 5063 votes


© 2024 - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us