PHP header does not redirect from imported XAMP web site

My website was working fine on XAMP. After transfer to 000webhost, header does not redirect.
The file is located at https://cookbookfamily.000webhostapp.com/cb/ix.php and the code is below.
At line 84, after the setcookie instructions, the header does not redirect and a blank page is displayed. I have tried with a script and window.location, with 301 option, etc. No way ! I can’t find the error of the fix.

You can troubleshoot this a couple of ways

  1. Ensure you are using the same PHP version on our hosting as you are locally

  2. Try using the latest PHP version where possible and the most recent PHP code and PDO method where possible to avoid issues and vulnerabilities.

  3. Enable buffering via .htaccess

You can do this by placing the code below into your .htaccess in the public_html folder

php_flag output_buffering on
  1. Troubleshoot with code in the file causing the problem

Simply input this code into the start of the files you wish to troubleshoot

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

This topic was automatically closed after 22 hours. New replies are no longer allowed.

Thanks a lot. The insertion into .htaccess made it all work.

1 Like

Glad to hear :grin: happy site building