Redirect loop

Discussion in 'aMember Pro v.4' started by kulnor, Dec 17, 2011.

  1. kulnor

    kulnor New Member

    Joined:
    Nov 27, 2011
    Messages:
    5
    After installing amember, tried to add a simple folder protection a directory but am getting a redirect loop (even if set to free content). Just upgraded to 4.1.9 but problem persist. Any suggestion as to where to start looking for potential resolution?
    thanks
    *P
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Can you post a screenshot of the folder protection? Also the htaccess code it created?

    David
  3. kulnor

    kulnor New Member

    Joined:
    Nov 27, 2011
    Messages:
    5
    David:
    screenshot attached (and at http://screencast.com/t/oGYvAT3ya)
    [​IMG]
    .htaccess below.
    many thanks
    *K

    Code:
    ########### AMEMBER START #####################
    Options +FollowSymLinks
    RewriteEngine On
    
    # if cookie is set and file exists, stop rewriting and show page
    RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
    RewriteCond /Library/WebServer/Documents/openmetadata/amember/data/new-rewrite/%1-2 -f
    RewriteRule ^(.*)$ - [S=3]
    
    # if cookie is set but folder file does not exists, user has no access to given folder
    RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
    RewriteCond /Library/WebServer/Documents/openmetadata/amember/data/new-rewrite/%1 !-f
    RewriteRule ^(.*)$ http://localhost/openmetadata/amember/no-access/folder/id/2 [L,R]
    
    ## if user is not authorized, redirect to login page
    # BrowserMatch "MSIE" force-no-vary
    RewriteCond %{QUERY_STRING} (.+)
    RewriteRule ^(.*)$ http://localhost/openmetadata/amember/protect/new-rewrite?f=2&url=%{REQUEST_URI}?%{QUERY_STRING} [L,R]
    RewriteRule ^(.*)$ http://localhost/openmetadata/amember/protect/new-rewrite?f=2&url=%{REQUEST_URI} [L,R]
    ########### AMEMBER FINISH ####################
    
  4. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Code looks right- send in a tech support ticket, maybe a bug or something specific to your hosting config.

    David
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    There was a bug in new-rewrite and it is fixed already.
    .htaccess file were not created right.
    Edit it and change this line:
    RewriteCond /Library/WebServer/Documents/openmetadata/amember/data/new-rewrite/%1 !-f
    to
    RewriteCond /Library/WebServer/Documents/openmetadata/amember/data/new-rewrite/%1-2 !-f
    It should be the same as the line in first block:
    RewriteCond /Library/WebServer/Documents/openmetadata/amember/data/new-rewrite/%1-2 -f

Share This Page