On the main index.php file, I’m redirecting the user if he is using a mobile phone. But after sending the Location header, the rest of the HTML would also be sent to the user, unnecessarily. Is there a way to prevent that and skip sending the normal HTML?
The code looks like this:
<?php
if(preg_match(...)){
header('Location: http://m.mysite.com/');
}
?>
<html>
...normal version of the website...
</html>
Always
exit;after a header( ‘Location’ ), so the action doesn’t continue. That should solve your issue.