Jump to content

header("Location: page.php"); redirects to page but seems to load cached version


Recommended Posts

I have a page with results from a query that displays that has a link (works fine - passes variables etc) that deletes that line item from a database.  It goes to the delete.php and actually executes and removes the item from the database and then has the line header("Location: page.php"); which returns BACK to the page displaying the results.  However, it shows the old results until I hit Refresh in the browser.  Its like the header is redirecting to a cached version of the page.  


NOTE:  This script used to work fine untouched when we where on a shared hosting account.  We JUST updates to VPS hosting by the same host.  Now this problem has risen and I can't figure out what is wrong.  From what I can guess is there is something in php.ini that is either not set, set or set wrong.  Any help would be greatly appreciated.



Link to comment
Share on other sites

Note* you should also be using a fully qualified URI in the header function. 

From the manual



HTTP/1.1 requires an absolute URI as argument to » Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.