1 Reply Latest reply on Jun 20, 2010 2:52 AM by Ian A.

    Logout issue with mod-rewrite

    glennyboy1

      Hi

       

      First off I must echo what is being said here. It's a crying shame that Developer Toolbox has been dropped.... I'm really not sure what will plug the gap?

       

      Well to my issue. I have mod-rewrite on pages of my site here:-

       

      http://www.allhomegrown.com/index.php

       

      and these strip out my /index.php?mod=checkout to syntax /checkout/

       

      When trying to logout I'm getting:-

       

      /checkout/index.php?KT_logout_now=1

       

      This stops it logging out as the transaction needs to go to:-

       

      index.php?KT_logout_now=1 (actually I'd rather it didn't check the url parameter and just logged out)

       

      I need to strip out the parent on the base url, but I can't get it to work. Can anyon advise how can I solve this issue?

       

      Cheers

       

      Glennyboy

        • 1. Re: Logout issue with mod-rewrite
          Ian A.

          Hello Glennyboy,

           

          There are two ways you can approach this situation.

           

          First is the easiest for you I feel.

           

          First make a duplicate page of the page you wish to redirect to, after logging out, (e.g. "signout.php" just in case anything goes wrong in the transaction, there is a page for the user to see), then on this page, set up the logout form:

          When you use the Logout Form Wizard, on the second step, select Page loads for the Define logout behaviour... Logout when. And then redirect it to the page you want it to as per normal.

           

          If you like you can strip out everything on the page and just leave the PHP code and once the transaction is complete it will redirect to the required page. If something goes wrong, you are left with a blank page, hence why I recommend a duplicate page with at least some of the site to show the user.

           

          All your signout / log out links then refer to the signout.php page - and of course you can rewrite the "signout.php" page in .htaccess along the lines of: RewriteRule ^sign_out/$ /signout.php or however you have set up your site structure.

           

           

          Second way requires you to alter the "tNG_logoutTransaction.class.php" file located in the "\includes\tng\" folder.

          In this file you will the following code:

           

          function getLogoutLink() {
                  $ret  =
          KT_getFullURI();
                  $ret = KT_addReplaceParam($ret, "
          KT_logout_now", "1");
                  return $ret;
              }

           

          You can replace the "KT_getFullURI();" with "$_SERVER['REQUEST_URI'];" - this will return everything after your domain name and append the following: "?KT_logout_now=1".  You could also replace the "KT_logout_now" with any text you like, e.g. "signout" -> but remember to change the value in the logout transaction at the top of your page, i.e.

          // Register triggers
          $logoutTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "GET", "
          KT_logout_now");

           

          That should give you "/checkout/?KT_logout_now=1"

           

          Alternatively, you could change the "KT_getFullURI();"  with "/", that will give a link back to the root of your site with "?KT_logout_now=1"

           

          Without knowing how you have written your RewriteRule in your htaccess file, hard to say how much the second method will work for you.

           

          I would try method one first to see how that works for you.

           

           

          Best of luck,

          Ian.