how can i 301 redirect one person from ip say 127.0.0.1 from /anypage.php to /newpage.php but only that one ip gets redirected?
As far as I can see htaccess doesn't allow redirecting by IP, so you'll need to do that in the PHP file. In anypage.php: if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') header("Location: newpage.php"); Code (markup):
<?php if ($_SERVER['REMOTE_ADDR'] == '111.111.111.111') header("Location: index.php"); require_once 'init.php'; $query = $db->Execute("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 ORDER BY RAND() LIMIT 1"); $row = $query->FetchRow(); $query->Close(); if ($row['ID']) { $query = $db->Execute("UPDATE {$tables['link']['name']} SET HITS=HITS+1 WHERE ID=".$db->qstr($row['ID'])); $query->Close(); } header("Location: " . $row['URL']); ?> PHP: it didn't work i replaced my ip, so that wasnt the problem. is the problem that header("Location: " . $row['URL']); Code (markup): is in the file twice?