I try to make a redirection in wordpress to change the page when the website is viewed by a mobile device. (I don’t want wp-touch). The target page is external to wordpress.
I added this code in the header.php wordpress file:
//test if it is a mobile device
...
if ($mobile_browser > 0) {
wp_redirect('Location: http://url-to-my-external-page' );
exit;
}
I also tried in the index.php file but it doesn’t work either.
What can I do?
Thanks
You’re mixing PHP’s
header()
function and WordPress’wp_redirect()
function.It’s either:
or
Should be: