Hi I am looking for a solution .

I want to redirect my mobile user to different Home Page . ie


I have created a function in Function.php

function so16165211_mobile_home_redirect(){
if( wp_is_mobile() && is_front_page() ){
    $redirect_url = 'https://example.com/mobile/';
    header('Location: ' . $redirect_url );
}}add_action( 'template_redirect', 'so16165211_mobile_home_redirect' );

Now its working perfectly the thing is I don't want Mobile to show https://example.com/mobile rather https://example.com

Any solution for it

Thanks in advance.

  • Don't, this will only invite more problems. Google will probably dislike it, but even more important: an URL should always (in my opinion) display one site, not something completely different for X – kero Jan 5 '18 at 11:10
  • The solution is to create a responsive layout that works on all screen sizes. "Mobile" doesn't mean small screen anymore. – fuxia Jan 5 '18 at 11:19
  • The Layout of mobile is complete different, Its App like Style.That's why responsive its not an option . – Abdul Saboor Rauf Jan 5 '18 at 11:23
  • And why the different URL? I mostly use Wikipedia's mobile pages on desktop as well, because they are neat and clean – kero Jan 5 '18 at 12:16
  • The Frontpage of my website is Stafic Page for Dekstop. That's why I created Different page for mobile. – Abdul Saboor Rauf Jan 5 '18 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.