I want to, once the user has arrived the page, first, download an item using another script and then, redirect him or her to the index.
So I have the following code:
$filename = $_GET["file"];
$down = 'components/com_djclassifieds/views/item/tmpl/download.php?file='.$filename;
header( "refresh:2;url=$down" );
header( "refresh:5;url=index.php" );
And, for example, the following url:
http://my.web.com/index.php?option=com_k2&view=item&layout=item&id=39&file=test.pdf
But it is not working. I also tried to use 'Location' in this code:
$filename = $_GET["file"];
header('Location: http://'.$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']).'/components/com_djclassifieds/views/item/tmpl/download.php?file='.$filename);
exit;
header( "refresh:5;url=index.php" );
And it downloads the file but after that it does not redirect me to the index.
What am I doing wrong?