Redirect Loop while using .htaccess for protected folder

Discussion in 'Troubleshooting' started by viveknarula, Jan 25, 2010.

  1. viveknarula

    viveknarula New Member

    Joined:
    Jun 10, 2009
    Messages:
    7
    Hi,

    I am using amember with new_rewrite module. Below is the code in the .htaccess file for protected directories.

    ########### AMEMBER START #####################
    Options +FollowSymLinks
    RewriteEngine On

    ## allow access for product #5
    RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
    RewriteCond SERVER_PATH/data/new_rewrite/%1-5 -f
    RewriteRule ^(.*)$ - [L]

    ## if user is not authorized, redirect to login page
    RewriteCond %{QUERY_STRING} (.+)
    RewriteRule ^(.*)$ http://www.MYSITE.COM/plugins/protect/new_rewrite/login.php?v=-5&url=%{REQUEST_URI}?%{QUERY_STRING} [L,R]
    RewriteRule ^(.*)$ http://www.MYSITE.COM/plugins/protect/new_rewrite/login.php?v=-5&url=%{REQUEST_URI} [L,R]
    ########### AMEMBER FINISH ####################


    When the User is not logged in the .HTACCESS redirects the user to Amember login page. However, when a user login It gives "REDIRCTED LOOP" error in my browser. At the browser address bar it shows the original URL of the protected folder.

    Please anyone to address my problem. Please let me know how to correct this.


    Thanks
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Are you protecting the amember folder or an outside folder?
    (you dont protect the amember folder)

    David
  3. viveknarula

    viveknarula New Member

    Joined:
    Jun 10, 2009
    Messages:
    7
    David i am protecting an outside folder.

    Thanks for your reply.
  4. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    @viveknarula: is your aMember folder within your "outside folder"

    can you share your paths here.

    example:

    mydomain.com/amember
    mydomain.com/protected folders/1
    mydomain.com/protected folders/2
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Also make sure that new_rewrite plugin is enabled in amember CP and /amember//data/new_rewrite folder have 777 permissions.
    The same problem can happen if your server use "translated" path for your site files.
    In this situation real system path can be different then path available from php.
    Check server error log real path should be available there.
  6. viveknarula

    viveknarula New Member

    Joined:
    Jun 10, 2009
    Messages:
    7
    Hi,

    I have installed the amember in my root of website.The folder i am protecting is are at Non-protected-Folder/Protected-Folder. The .HTACCESS file (with code mentioned above) is inside the protected-folder.

    Also, i have checked within my browser Cookie name as " amember_nr " is created after login and then it gives Redirected Loop Error.

    Please Suggest.

    Thanks
  7. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Please contact me in helpdesk and provide access info I will check what can be wrong.
  8. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    @memosystem: where do you have aMember installed?

    root <- directly in root?

    root\amember <- subfolder from root?

    Ensure you do not have a) root folder protected (if you need to, exclude aMember folder) b) aMember folder protected
  9. kraney

    kraney New Member

    Joined:
    May 26, 2010
    Messages:
    1
    Was this ever solved??

    If so, how?

    I'm having the same issue. However, it's only for certain products.

    I've got 4 products. Product 1 works fine, but products 2,3, & 4 give the redirect loop when trying to view the content from the "login" link on the thank you page, as well as when trying to access from the account page.

    Any help is appreciated...
  10. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    check the product urls for 2, 3 & 4.. what is different from product 1? Check the .htaccess files, what is different?

Share This Page