new_rewrite override setting

Discussion in 'Setting-up protection' started by davidm1, Sep 6, 2008.

  1. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
    This is how I overcame the new_rewrite not being enabled in my v3.1.3
    amember/admin/protection_methods.inc.php

    function protection_check_new_rewrite(){
    // comment out the lines
    // elseif ($ret != '2-second_file')
    // return "RewriteRule doesn't work in .htaccess files on this server";


    David
  2. maxpig

    maxpig New Member

    Joined:
    Aug 14, 2008
    Messages:
    7
    That worked!

    David,
    Thanks so much! Your workaround worked perfectly.

    Peggy
  3. anthmyers

    anthmyers New Member

    Joined:
    Jan 21, 2009
    Messages:
    39
    It's encrypted, how am I supposed to edit it?
  4. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
    The pro version isn't encrypted.

    David
  5. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    But how can I test it to make sure I want to buy it if I can't get it working with the demo version?

    ...oh wait, he was supposed to ask that not me ;-)
  6. bigwavetrading

    bigwavetrading New Member

    Joined:
    Sep 24, 2007
    Messages:
    3
    Same Issue with aMember Remote

    Just wanted to add here that same issue happened with the remote plugin, edit
    amember_remote/protection_methods.inc.php

    about line 37 comment out 3 lines as below:

    $ret = get_url($url = $config[root_url]."data/tests/mod_rewrite/1.php");
    if (!strlen($ret)){
    $err[] = sprintf(_TPL_READ_FAQ, $url);
    $res = true;
    //} elseif ($ret != '2-second_file'){
    //$err[] = _TPL_REWRITERULE_DOESNT_WORK;
    //$res = true;
    }

    Hope this helps someone
  7. vmpbs

    vmpbs New Member

    Joined:
    Nov 3, 2008
    Messages:
    5
    For Newbies

    Hi there, I know most of us have some knowledge in this field but for newbies here's what you have to do. Open the file called protection_methods.inc.php located under the admin folder of your amember instalation. Edit it with some text editor like textwrangler. Find the function line previously mentioned function protection_check_new_rewrite(){

    You will see several if's and the two lines (usually the last two of that function) that say:

    elseif ($ret != '2-second_file')
    return "RewriteRule doesn't work in .htaccess files on this server";

    Need to be canceled (commented out) to do this just place two slashes before each line so they should read

    //elseif ($ret != '2-second_file')
    //return "RewriteRule doesn't work in .htaccess files on this server";

    instead of the original format. Now save the file and try to use the protection again.
  8. mylkhead

    mylkhead New Member

    Joined:
    May 28, 2010
    Messages:
    16
    the override works, but images/flash do not load for me

    I modified this code and it correctly enabled the "greyed-out" option for using new_rewrite. I chose it and it correctly protected the folder. So when accessing it, it redirects me to the login screen which is what I want.

    But once I logged in and accessed the /pro/ version of my app, it wasn't loading any of the images or flash (other than externally hosted banner ads and such).

    I sent an email to tech support and they did the same exact thing that I already did but I'm still having a problem loading the page.
  9. mylkhead

    mylkhead New Member

    Joined:
    May 28, 2010
    Messages:
    16
    A follow up, tech support says "works for me" but didn't really suggest any other solutions here. The problem of the images/flash not loading still exists.

    I used Firebug and saw that it kept trying to load the images but they were giving a "302 found" error http://en.wikipedia.org/wiki/HTTP_302

    This did not happen when using the htpasswd protection method. Why would it do this when using the new_rewrite method?
  10. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Sorry for incorrect reply in support.
    This has been fixed.
    I believe you use RackSpace Cloud hosting or something similar?
    issue was in media accelerator they have installed(varnish), it store media content in cache, and unfortunately skip cookies when you try to load any media file.
    So, aMember think that user is not logged in and redirect user back to login page(that's why you see many 302 redirects)
    /amember/plugins/protect/new_rewrite/new_rewrite.inc.php was changed.
  11. onewake

    onewake New Member

    Joined:
    Jul 2, 2009
    Messages:
    9
    Alex,

    Are you saying that Amember WILL work with rackspace cloud sites now? Several months back I worked with my developer (and you and them) on getting this to work and it never did.

    Has that issue been addressed?
  12. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Yes it will work with little modification of new_rewrite.inc.php also we plan to include fix for this into next version.
  13. gary_gus

    gary_gus aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    2
    what is the patch

    I am using 3.1.4PRO and would love to know what the mod is for that file so I can fix this issue today.

    What is the "little modification of new_rewrite.inc.php"
  14. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Edit /amember/plugins/protect/new_rewrite/login.php and change this:
    header("Location: $_SESSION[amember_nr_url]");
    to
    PHP:
    if(strpos($_SESSION[amember_nr_url], '?')===false){
       
    header("Location: $_SESSION[amember_nr_url]?cache=0");
    }else{
       
    header("Location: $_SESSION[amember_nr_url]&cache=0");
    }
  15. adrianogaleno

    adrianogaleno Member

    Joined:
    Jun 26, 2007
    Messages:
    34
    Is this solution still valid for those who use Rackspace and is getting the same message (RewriteRule doesn't work in .htaccess files on this server)? I migrated from a different host provider while ago and, functionality wise, everything seems to be working fine. However, when I tried to add more products to a folder, I got the error above. I'm using version 3.2.3PRO.
  16. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Yes it should help in your situation.

Share This Page