WordPress.org

Ready to get started?Download WordPress

Forums

Mobile Domain
[resolved] Can you whitelist URLs? (6 posts)

  1. ccl1111
    Member
    Posted 2 years ago #

    Looking to allow the user to go to a couple pages on the main domain (not the mobile domain - using subdomain m.). Is there a way to allow someone to go to those without redirecting them?

    Thanks!

    http://wordpress.org/extend/plugins/mobile-domain/

  2. Yusuf
    Member
    Plugin Author

    Posted 2 years ago #

    #ccl1111
    Sorry for a long reply,
    yes there is, but user have to click “Desktop Version” in the bottom of mobile site, then cookie will stop redirecting wordpress to mobile version.

  3. jukooz
    Member
    Posted 2 years ago #

    How to do it? Link to desktop version on my mobile domain doesn't allow user to go to Desktop version. Any special url query parameters or something?

  4. ccl1111
    Member
    Posted 2 years ago #

    We ended up using this plugin. http://wordpress.org/extend/plugins/mobileesp-for-wordpress/ and basically edited the mobileesp_wp.php file to include some if statements toward the top. You don't include the domain in the URI string.

    We still needed the ability to have the user bypass the mobile domain completely so we didn't highjack that. Instead, for the pages we wanted to whitelist, we cookied them for a short amount of time.

    Example of the code we injected after the define statement...

    if($_SERVER['REQUEST_URI'] == '/page-uri-after-domain-1/'){
    	//print page & exit
    	setcookie("mobileesp_wp_full_site", 1, time()+5, "/", $domain);
    	$_COOKIE['mobileesp_wp_full_site'] = 1;
    }
    
    if($_SERVER['REQUEST_URI'] == '/page-uri-after-domain-2/'){
    	//print page & exit
    	setcookie("mobileesp_wp_full_site", 1, time()+5, "/", $domain);
    	$_COOKIE['mobileesp_wp_full_site'] = 1;
    }
  5. jukooz
    Member
    Posted 2 years ago #

    I ended up using Tera-WURFL. I was planning it but was to lazy to get to know it. It came out it was so easy... You can install it on your host or use it installed on http://wurfl.thesedays.com/

    I made very universal version of my configuration, so I can pass it to someone (client's webmaster) and give him no more than a minute of work to set redirection for me.

    I add 1 line to .htaccess file:

    DirectoryIndex handleRequest.php index.html index.shtml index.php index.htm default.html Default.htm default.html Default.html default.shtml Default.shtml page1.html index.pl index.cgi index.php3 index.phtml home.htm home.html home.shtml index.wml

    Attach my handleRequest.php file:

    <?php
    
    // Include TeraWurflRemoteClient.php
    require_once ('TeraWurflRemoteClient.php');
    
    // Instantiate a new TeraWurflRemoteClient object
    $wurflObj = new TeraWurflRemoteClient('http://wurfl.thesedays.com/webservice.php');
    
    // Define which capabilities you want to test for. Full list: http://wurfl.sourceforge.net/help_doc.php#product_info
    $capabilities = array("product_info");
    
    // Define the response format (XML or JSON)
    $data_format = TeraWurflRemoteClient::$FORMAT_JSON;
    
    // Call the remote service (the first parameter is the User Agent - leave it as null to let TeraWurflRemoteClient find the user agent from the server global variable)
    $wurflObj->getCapabilitiesFromAgent(null, $capabilities, $data_format);
    
    // Use the results to serve the appropriate interface
    if ($wurflObj->getDeviceCapability("is_tablet") || !$wurflObj->getDeviceCapability("is_wireless_device") || $_GET["ver"]=="desktop") {
    	include("index.php"); //default index file
    } else {
    	header('Location: http://m.google.com/'); //where to go
    }
    ?>

    And attach required TeraWurflRemoteClient.php file. Just add "?ver=desktop" when linking back to desktop website and you are set :)

  6. jukooz
    Member
    Posted 2 years ago #

    I tried MobileESP but it didn't recognize my Android phone with Dolphin HD browser so I passed on it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic