• Resolved danielmark

    (@danielmark)


    My main site always got redirected to subdomain whenever I open it in mobile browser, but it works fine in pc browser. I already test it using different phone, clearing the cookie and data but still nil. I already change template and disable plugins in both of subdomain and domain. What possibly wrong?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Sounds like you have a plugin or some other code somewhere possibly in your themes functions.php or header.php that is redirecting to a subdomain if a mobile device is detected.

    Confirm that it is not a plugin by disabling all plugins testing the site on mobile to see if the problem persists… if it does not then reenable plugins one by one until the problem returns. When the problem returns you know which plugin is causing the issue.

    If it is not a plugin you’ll need did in your themes code to find the code that is causing this.

    It could also be code in the htaccess file.

    Hope this helps!

    Thread Starter danielmark

    (@danielmark)

    Still same already switching to default theme in both of site, disable all plugin too and my htaccess code seems clean

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    • This reply was modified 6 years, 4 months ago by danielmark.

    Hmmm. I am at a loss. There must be some code somewhere that is causing the mobile devices to forward to a subdomain. Would you please provide me a list of the plugins you are using on one of the sites?

    Thread Starter danielmark

    (@danielmark)

    No problem, here the list, I am using Jannah theme

    Elfsight Google Maps CC
    Wordfence free
    Jannah extension
    Jannah switcher
    layer slider
    Premium SEO pack – WordPress Plugin
    Re-add text underline and justify
    Yoast SEO Premium
    Taqyeem – Buttons Addon
    Wp rocket
    Maintenance
    Wordpress Pinterest Automatic

    Deleted already
    Swift Performance Lite
    Premium Seo Pack

    Personally, I’ve never used many of those plugins..
    However, I have used Yoast Premium of a few clients sites (unfortunately I am not working on any of those sites any longer and thus do not have access to refer to the wp-admin on any of them). That said, I do recall there being something in Yoast Premium about redirecting mobile users to a different homepage. I could be wrong but the member seems very distinct. Look as closely as you possibly can at the settings for Yoast and see if you can not find anything in there that might be causing this.

    Hope this helps!

    Thread Starter danielmark

    (@danielmark)

    It seems the problem, not from either Yoast or the theme, I already uninstalled both. Maybe I need to add some code? in htaccess or where? So far I know, whenever I access https//domain.com it got redirected to https//subdomain.domain.com in any phone (already clear the cookie repeatedly)

    Check your index.php file to see if there is any code in there that could be forwarding mobile devices.

    You can use https://pastebin.com/ to share the code with us if you would like us to review it and tell you if we see anything.

    Thread Starter danielmark

    (@danielmark)

    I found the error, it due to different nameserver between hosting and Cloudflare. I contacted the hosting provider to fix it. And now works as charm as before. Thanks, Denavi for keeping with me.

    My pleasure! Happy to help where I can. Thats what the support forum is here for. Did not even think it could be a caching or CDN issue… I will keep that in mind for next time the same issue arises!

    • This reply was modified 6 years, 4 months ago by Davood Denavi.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Fix domain always get redirected to subdomain’ is closed to new replies.