php redirect and ical download issues
<p>Our application have lots of old ical links and I am trying to redirect them to the new url. I can't do a .htaccess redirect because this new url is generated using php . There fore I am using php's header function to redirect users from redirect.php to test.php . But the problem is , if user access example.com/redirect.php .. ical file gets downloaded but the url in the browser remains example.com/redirect.php. It should have changed to example.com/test.php. I am using a 301 redirect. </p>

<p>I have tried javascript window.location.href function but the same results are coming in. I hope I have explained it properly. Thanks for the help. </p>

<p>First php file for example redirect.php have this code in place. </p>

<pre><code>&lt;?
header("Location: http://example.com/test.php");
?&gt;
</code></pre>

<p>Second file test.php have this code to download an ical file. Code goes like this. </p>

<pre><code>&lt;?php
header("Content-Type: text/Calendar");
header("Content-Disposition: download; filename=calendar.ics");
echo "BEGIN:VCALENDAR\r\n";
//echo "X-WR-TIMEZONE:America/New_York\r\n";
echo "X-APPLE-CALENDAR-COLOR:#b91113\r\n";
echo "X-WR-CALNAME:$cal_name\r\n";
echo "VERSION:2.0\r\n";
echo "PRODID:-//Test//NONSGML Test//EN\r\n";
echo "METHOD:PUBLISH\r\n";
echo $data;?&gt;
</code></pre>

<p>If I remove header code for Ical download, this redirect works. URL in the browser window changes to the new location. </p>
