I have a strange bug with my script, i just want redirect user if the URL finish by '/' to the same URL without any '/' at the end.
i get this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/xxx/httpdocs/series.php:1) in /home/httpd/vhosts/xxx/httpdocs/series.php on line 7
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/mxxx/httpdocs/series.php:1) in /home/httpd/vhosts/xxx/httpdocs/series.php on line 8
Code:
<?php
$urlLast = $_SERVER['REQUEST_URI'];
$urlLast = substr($urlLast, -1);
if (($urlLast == '/') && (!strstr($_SERVER['REQUEST_URI'], 'en-streaming')))
{
$newURL = substr($_SERVER['REQUEST_URI'],0,-1).'-en-streaming';
header("Status: 301 Moved Permanently", false, 301);
header("Location: ".$newURL."");
}