Good morning
Please could you advise where I am going wrong with the following code:
if(isset($_GET['id']))
{
header ('HTTP/1.1 301 Moved Permanently');
$arr = array("6" => "films", "7" => "television", "8" => "music");
$num = $_GET['id'];
header("Location: http://www.mysite.co.uk/reviews-{$array['$num']}.php");
}
What I am trying to achieve is when someone types in www.mysite.com/reviews.php?id=6 it redirects them to www.mysite.com/reviews-films.php
Feel free to tell me I should be using mod_rewrite - I am, but I cannot get the 301 to work with mod-rewrite, so for the pages already indexed by google, I thought I would just write a quick 301 in php.
The code above is not displaying the correct result from the array - it is just being left blank. I don't know how to echo the array result into a header command, or whether it is even allowed!?
Many thanks