Support » Plugin: WPtouch » Plugin switches to https when changing between mobile and standard view

Viewing 15 replies - 1 through 15 (of 26 total)
  • I’m having the same problem.

    The URL in question is

    The mobile site loads correctly, but when I flip the switch to go to turn off the mobile theme, the URL loads as “https” and doesn’t load.

    If I manually load the non-mobile page and then flip the switch back to mobile, the “s” is added to http and it doesn’t load.

    I’m on a self hosted network – WP v 3.4.2 – the other 4 blogs on my network do not have this problem. They switch fine.

    I’m using the plugin WordPress MU Domain Mapping V to map the domain onto my installation.

    These 2 threads seem to reference the same issue:

    Thanks for any help you can give.

    Plugin Author BraveNewCode Inc.


    Hi gavinwatson,

    Do you have any ssl-based plugins or setups going on on your website at all?

    Same question for you Ron. What’s the difference between the site you’re seeing this issue on and the rest of the sites in your multisite network?

    Hi, thanks for responding.

    No, I have no ssl-based plugins, I do not run multisite either.


    Plugin Author BraveNewCode Inc.


    Thanks for the info there gavinwatson. Please share the URL of at least one of the website in question and we’ll be happy to take a look for you. Also, what device are you using to test?

    I’m using a Samsung Galaxy SIII


    >>What’s the difference between the site you’re seeing this issue on and the rest of the sites in your multisite network?

    The only difference between the one that’s not working and the ones that are seems to be the Domain Mapping plugin

    here are some blogs on my network that work:

    the one that doesn’t work is — it’s domain mapped to

    using the plugin: WordPress MU Domain Mapping – Version

    WordPress is current – 3.4.2

    I’m having the issue on iphone with current software and droid.

    The message I’m receiving is “unable to establish a secure connection.”

    Turning the mobile theme off attempts to establish the connection via https (the same thing happens coming from standard to mobile version)

    I’ve noticed we’re having the same problem. Desktop mode redirects to https instead of http. We’re not using any cache plugins at this moment and we do not use plugins related to ssl.

    Quick dirty fix is to edit line 554 of wptouch.php to

    $protocol = ( !empty($_SERVER['HTTPS']) ) ? 'http://' : 'http://';

    BraveNewCode Inc.,

    it’s late over here in the Netherlands, I’m sleepy and already in bed so forgive me if I make any mistakes.

    Using empty() with $_SERVER[‘HTTPS’] here isn’t going to work for some users because

    Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.


    ‘Off’ is what I get when I echo $_SERVER[‘HTTPS’].

    This seems to do the trick without forcing $protocol to use http://,
    change line 554 of wptouch.php to:

    $protocol = ( !empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off' ) ? 'https://' : 'http://';

    I’m not sure about this though. Use it your own risk 🙂

    Plugin Author BraveNewCode Inc.


    Because this is not a widely reported issue, we are speculating that there is something else in common with the sites in question where this occurs. Perhaps you happen to be using the same desktop theme or themes from the same developer? Until we can reproduce the issue here, we really haven’t a way to test what’s happening for you so as much information about your individual WordPress configurations (themes and plugins) from all affected is helpful.

    @jacquesdancona, thank you for sharing your solution. Hopefully it is helpful to others experiencing this issue until it’s isolated and address on our end.

    I’m wrong about my fix and I need to be sleeping. Last thing I found with help from here:

    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
        || $_SERVER['SERVER_PORT'] == 443) {
        $protocol = "https://";
    } else {
       $protocol = "http://";

    On from what Jacquesdancona has written, I also decided to take a look at this and I found in this code from wptouch.php (inside the wptouch folder within the plugins folder):

    function bnc_check_switch_redirect() {
    		if ( isset( $_GET['wptouch_redirect'] ) ) {
    			if ( isset( $_GET['wptouch_redirect_nonce'] ) ) {
    				$nonce = $_GET['wptouch_redirect_nonce'];
    				if ( !wp_verify_nonce( $nonce, 'wptouch_redirect' ) ) {
    					_e( 'Nonce failure', 'wptouch' );
    				$protocol = ( !empty($_SERVER['HTTPS']) ) ? 'https://' : 'http://';
    				$redirect_location = $protocol . $_SERVER['SERVER_NAME'] . $_GET['wptouch_redirect'];
    				header( 'Location: ' . $redirect_location );

    If you change this line FROM:

    $protocol = ( !empty($_SERVER['HTTPS']) ) ? 'https://' : 'http://';

    TO this :

    $protocol = ( !empty($_SERVER['HTTPS']) ) ? 'http://' : 'http://';

    (removed the ‘s’ from https)

    It all seems to work fine.

    Unfortunately, I don’t know what other effects this may have! But it worked for me.

    Hi, sorry, I have just realised that my solution is exactly the same as the one already provided!

    I’m not sure why the original solution (which is the same as what I did) is not sufficient? Will it have any other effect that I should be worried about??


    Hi Gavin,

    That’s what I tried to explain in my quick dirty fix post (4 posts back 😉 ).

    This will work for you because you’re forcing it to use ‘http://’.
    If you don’t use https in any way this won’t result (I think) in any problems. However, if you update WPtouch the edit will be overwritten with a new wptouch.php.

    The problem does not seem to be theme or plugin related because I did a fresh install yesterday (default Twenty Twelve theme) with only WPTouch installed and the problem still occurs. I’ve already tested this three WordPress installs on two Microsoft-IIS/6.0 systems (one VPS and one shared hosting account).

    I’m currently emailing with Brave New Code and they have access to these WP installs. They’ll probably check today.

    By the way, thanks for the quick support and emails, Brave New Code!

    Plugin Author BraveNewCode Inc.


    We’ve had a look at @jacquesdancona‘s setup and can reproduce the error though, still, not in any of our development environment setups. That leads us to suspect his server setup. There may be server-side commonalities among those experiencing the issue. We recommend reporting the issue to your host to see what they can track down for you.

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Plugin switches to https when changing between mobile and standard view’ is closed to new replies.