 
	
		Tagged: mobile
- 
		AuthorPosts
- 
		
			
				
January 7, 2014 at 8:43 am #206194I posted about this a little earlier and Josue sent me this link to check out. I’m trying the 3rd post. When i put the code at the top of my headers.php file it didn’t perform a redirect and the code showed up on my site. So i added a line above it, right at the top of my headers.php file, “<?php” and now the site just shows up as a blank white page. Any suggestions as to what I might be doing wrong? This is how the top of my headers.php file looks now : <?php 
 if( is_front_page() ){include_once(‘mobile-detect/Mobile_Detect.php’); 
 $detect = new Mobile_Detect();if ( $detect->isMobile() || $detect->isTablet() ) { 
 $redirect_url = ‘http://jonnyfreesh.com/music’;
 header(‘Location: ‘ . $redirect_url ); // Redirect the user
 }
 }
 <?php
 global $avia_config;$style = $avia_config[‘box_class’]; 
 $responsive = avia_get_option(‘responsive_layout’,’responsive’);
 $blank = isset($avia_config[‘template’]) ? $avia_config[‘template’] : “”;
 $headerS = !$blank ? avia_header_setting() : “”;
 $headerMenu = $responsive ? avia_get_option(‘header_menu’,’mobile_drop_down’) : “”;?> Thanks Jonny January 7, 2014 at 9:02 am #206209doh! Very new to custom coding. Didn’t work though, still same problem. Any other suggestions? January 7, 2014 at 9:12 am #206215Hey! Please remove the code then install this plugin: http://wordpress.org/plugins/wp-mobile-detect/ Edit header.php, find this code on line 2: global $avia_config;On top of it, add this code: if( wpmd_is_phone() ){ $redirect_url = 'http://jonnyfreesh.com/music'; header('Location: ' . $redirect_url ); // Redirect the user }Remove browser cache then reload the page. Regards, 
 IsmaelJanuary 7, 2014 at 9:30 am #206218Thanks Ismael, It worked on opera but not on safari on an iphone. The error message was that Safari can’t open the page because too many redirects occurred. I think the problem is that this applies to every url on my site, and so it’s infinitely redirecting to a page with a redirect on it. I just want to redirect one page – http://www.jonnyfreesh.com to http://www.jonnyfreesh.com/music – is it possible to do this with this plugin and different code? Thanks January 7, 2014 at 3:13 pm #206342Hi! Please try this one: if( wpmd_is_phone() && is_front_page() ) { $redirect_url = 'http://jonnyfreesh.com/music'; header('Location: ' . $redirect_url ); // Redirect the user }Regards, 
 IsmaelJanuary 8, 2014 at 3:40 am #206604Hi Ismael, That one works thanks :) If I want to apply this to tablets as well, would I add this below it? if( wpmd_is_tablet() && is_front_page() ) { 
 $redirect_url = ‘http://jonnyfreesh.com/music’;
 header(‘Location: ‘ . $redirect_url ); // Redirect the user
 }Thanks Jonny January 8, 2014 at 4:18 am #206621
- 
		AuthorPosts
- The topic ‘HomePage ReDirect on Mobile Sites’ is closed to new replies.
