$filename = "domainin.txt";
$fp = @fopen($filename, 'r');
if ($fp) {
$array = explode("\n", fread($fp, filesize($filename)));
}
$num = count($array);
for ($i=0;$i<$num;$i++){
$domains = explode(',', $array[$i]);
$result[] = $domains;
}
foreach($result as $val) {
if($_SERVER['REQUEST_URI'] == $val[0]){
header ('HTTP/1.1 301 Moved Permanently');
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/');
header('Location: '.$val[1]);
exit(0);
}
}
I have this which reads a txt file and reroutes URL's. However, a URL has é in the address and it won't read it and simply ignores it. How can I force it to read and recognize the special characters?
Example of text file is as follows...
/path/to/url/original-oné/, /path/to/url/new/
/path/to/url2/original/, /path/to/url2/new/
/path/to/url3/original/, /path/to/url3/new/
It's not reading /original-oné/ as the é is like that, it totally skips