WordPress.org

Ready to get started?Download WordPress

Forums

Simple Mobile URL Redirect
[resolved] Directory exclusion (2 posts)

  1. rembert
    Member
    Posted 1 year ago #

    I've installed this plugin with success and it works well. I have built a mobile site on a wordpress environment with MobileChief Mobile Site Builder. This plugin builds the mobile site on a sub folder of the main site.

    At first I suspected the MobileChief plugin to be in error as any link I clicked returned me to the mobile homepage. But with some debugging I discovered it was the Simple Mobile URL Redirect plugin which was causing problems as the plugin will redirect each and every URL which is different from the forwarding URL. I've considered to install the JumpMobi plugin instead but their site is down for maintenance. So I decided to patch your plugin to support excluding a directory from forwarding. This is a rather easy patch. To exclude the directory /mobile-sites/ from forwarding

    To patch, edit the file wp-content/plugins/simple-mobile-url-redirect/mobile-redirect.php and find this line:

    $cur_url = esc_url("http://". $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );

    Then add following lines to it:

    $exclude = '/mobile-sites/';
    $cur_urlparsed = parse_url($cur_url);
    $cur_urlpath=$cur_urlparsed['path'];
    if (strpos($cur_urlpath,$exclude) === 0) return;

    http://wordpress.org/extend/plugins/simple-mobile-url-redirect/

  2. InsideOut Solutions - Ozette Plugins
    Member
    Plugin Author

    Posted 1 year ago #

    Looks like a great work around for your use.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.