• Hi,

    I am trying create a manual redirect so that I can let my visitor choose where they are going next as apposed to automatically sending them through browser detection, I can create a splash page easily but how do I include the string in the browser so that the visitor goes to the same page on a different url, the only code I can find is 301 redirect which I can only make it permanently redirect apposed to the visitor choosing.

    Many thanks in advance for any thoughts or solutions

    Mark

Viewing 15 replies - 1 through 15 (of 22 total)
  • are you saying that on the first visit, they choose, but from that point forward, they don’t? and what do you mean by go to the same page on a different url, as far as a browser is concerned, if it’s a different url, it’s a different page, even if the content is the same.

    Thread Starter markweb

    (@markweb)

    Luckdragon,

    thanks so much for getting back to me, I will try to explain in a bit more detail.

    If a visitor visits site from google the address in the browser could be something like this:

    mainsite.com/norovirus/cruise-ship-norovirus/

    but I want them to have a choice to go to the mobile site so that they would still see the same page on mobile site as the link structure is the same so they would then go to:

    mobilesite.com/norovirus/cruise-ship-norovirus/

    basicaly the visitor would see two links

    1)mobile 2)desktop

    setting up two links on the splash page I can manage, the problem is adding the original string to the second site link so that visitor doesn’t have to do another search to get where they wanted too is the bit that I am struggling with.

    it would seem to be basically a 301 follow all links which works manually instead of automatically thus giving the visitor a choice.

    Regards

    Mark

    why can’t you just hardcode the link? i.e.

    <a href='mobilesite.com/whatever/whatever'>Mobile Site</a> |
    <a href='mainsite.com/whatever/whatever'>Main Site</a>

    also, I would recommend the use of subdomains..
    i.e. mainsite.com just has the “choice” page which directs them to either mobile.mainsite.com or desktop.mainsite.com

    you could easily create an index.php file for “mainsite.com” that does:

    Please Choose Your Destination:
    <a href='mobile.mainsite.com<?=$_SERVER['REQUEST_URI']?>'>Mobile Site</a> |
    <a href='desktop.mainsite.com<?=$_SERVER['REQUEST_URI']?>'>Desktop Site</a>

    <?

    Thread Starter markweb

    (@markweb)

    Hi, thats exactly what I want to achieve, I have tried adding the code to my splash page but it is html section of wp spash and come back with errors when I add the following:

    Please Choose Your Destination:
    <a href='https://mobile.mysite.co.uk<?=$_SERVER['REQUEST_URI']?>'>Mobile Site</a> |
    <a href='mysite.co.uk<?=$_SERVER['REQUEST_URI']?>'>Desktop Site</a>

    is there anyway I can make this work on the html spash page ?

    Regards

    Mark

    why does it have to be html? you can’t create a .php file?

    Thread Starter markweb

    (@markweb)

    Hia,

    thanks for being so patient, the main reason is that I am using a the wp splash page plugin which allows images and video but also html code as options to be added the splash page,

    It also allows you to setup many other options like time delays ect… though it seemed like a good starting place.

    Regards

    Mark

    Plugin Page

    yes, but it is still wp, which means that it’s a script, you could add a filter to functions.php that parses out variables

    so you could do like:

    <a href='mainsite.com/%%uri%%'>Main Site</a> |
    <a href='mobilesite.com/%%uri%%'>Mobile Site</a>

    then in functions.php for your theme:

    add_filter( 'the_content', 'my_the_content_filter' );
    function my_the_content_filter($content) {
    
      $content = str_replace("%%uri%%",$_SERVER['REQUEST_URI'],$content);
      return $content;
    }
    Thread Starter markweb

    (@markweb)

    Hi, I have added the code and I am returning the following in the browser for main site:

    https://mobilesite.com/mainsite.com/%%uri%%

    and the following for mobile site:

    https://mobilesite.com/mobilesite.com/%%uri%%

    and the error message

    400 bad request

    Bad Request

    Your browser sent a request that this server could not understand.

    is the page you’re displaying part of the plugin, or is it actually a page ?

    Thread Starter markweb

    (@markweb)

    Hi its proberly easier to just show you the mobile site

    Regards

    Mark

    no, the filter that I gave you works on post/page content… if the plugin you are using for the splash page doesn’t have post/page content, then we need to do it a different way.

    are you using the html option or the iframe option?

    Thread Starter markweb

    (@markweb)

    No the plugin doesn’t have post page content, the only other option is to include a page, which it does do in a frame and so not sure that that’s any help.

    Mark

    Thread Starter markweb

    (@markweb)

    I have been using the HTML option

    ok, then in the plugin, in the file:
    wsi/wsi/front/splasy/content.inc.php

    you will find:

    <?php echo stripslashes($siBean->getWsi_html()); ?>

    change it to:

    <?php echo stripslashes(str_replace("%%uri%%",$_SERVER['REQUEST_URI'],$siBean->getWsi_html())); ?>

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Manual Redirect’ is closed to new replies.