mobile redirect – warning cannot modify header info
-
Hi…
Trying to add a redirect to my wordpress site to my mobile website.
I have a custom home page that I created. I added the following to the custom home page:<?php
$agent = $_SERVER[‘HTTP_USER_AGENT’];
if(preg_match(‘/iPhone|Android|Blackberry/i’, $agent)){
header(“Location: https://www.google.com”);
exit;
}
?>But it results in this error:
Warning: Cannot modify header information – headers already sent by (output started at …..
Is there a different place I should be adding this code?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘mobile redirect – warning cannot modify header info’ is closed to new replies.