How to prevent page redirect?

When we want to redirect to new page page in PHP we need header(' Location : www.example.com' )..but this need output buffering..! Is there any other method in php to redirect to another page without header() and javascript..?

  • Answer:

    first let me know reason behind without php and javascript

Shiva Vs at Quora Visit the source

Was this solution helpful to you?

Other answers

Except PHP header(....) or javascript you can use html tag 'meta' refresh for redirection http://en.wikipedia.org/wiki/Meta_refresh

Sandeep Singh Bisht

yes you can redirect even via HTML meta tag (no php, jquery required) add this code in head part: <meta http-equiv="REFRESH" content="0;url=www.the-domain-you-want-to-redirect-to.com">

Avil Porwal

Javascript: window.location = "your url"; More info: http://www.tizag.com/javascriptT/javascriptredirect.php

Sven Al Hamad

Simply Replace: header("Location: www.example.com"); with $URL="http://www.example.com/"; echo "<script type='text/javascript'>document.location.href='{$URL}';</script>"; Here's one more way to http://mycodingtricks.com/snippets/php/redirect-php-without-using-header/.

Shubham Kumar

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.