Protecting Drupal sub folders - Error 404 message

Discussion in 'Setting-up protection' started by ellispratt, Mar 25, 2010.

  1. ellispratt

    ellispratt New Member

    Joined:
    Jul 30, 2009
    Messages:
    11
    I've set up aMember folder protection for our Drupal site (we've bought the Drupal plugin).

    The problem is, when you log on via the aMember login you can see the home page of the protected folder, but none of the content sitting in the sub-directories.

    Set up is:

    aMember located in: www.example.com/amember
    Drupal located in: www.example.com/amember/files/drupal
    The inaccessible content is located in sub directories off the drupal folder (e.g. www.example.com/amember/files/drupal/videos)

    In aMember, I've protected the folder (www.example.com/amember/files/drupal/) by selecting the new_rewrite option.

    In the www.example.com/amember/files/drupal folder there doesn't seem to be a .htaccess file to modify, and I get a forbidden error if I try to upload one.

    The ISP's Web server is running Apache, I think.

    What do I need to do?
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Please contact us in helpdesk and provide exact steps how to recreate this issue.
  3. ellispratt

    ellispratt New Member

    Joined:
    Jul 30, 2009
    Messages:
    11
    .htaccess file has now appeared

    I was composing an email to support and creating some screen grabs, when I noticed there is now a .htaccess file in the Drupal folder. I don't know why I couldn't see that file yesterday.

    It contains (for consistency, I've amended the domain to example.com):

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

    ## allow access for product #22
    RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
    RewriteCond /home/5471/ejpratt/www.example.com/public_html/amember/data/new_rewrite/%1-22 -f
    RewriteRule ^(.*)$ - [L]

    ## allow access for product #21
    RewriteCond %{HTTP_COOKIE} amember_nr=([a-zA-Z0-9]+)
    RewriteCond /home/5471/ejpratt/www.example.com/public_html/amember/data/new_rewrite/%1-21 -f
    RewriteRule ^(.*)$ - [L]

    ## if user is not authorized, redirect to login page
    # BrowserMatch "MSIE" force-no-vary
    RewriteCond %{QUERY_STRING} (.+)
    RewriteRule ^(.*)$ http://www.example.com/amember/plugins/protect/new_rewrite/login.php?v=-22,21&url=%{REQUEST_URI}?%{QUERY_STRING} [L,R]
    RewriteRule ^(.*)$ http://www.example.com/amember/plugins/protect/new_rewrite/login.php?v=-22,21&url=%{REQUEST_URI} [L,R]
    ########### AMEMBER FINISH ####################

    I've added the code suggested in the "A-z (how To Protect Files And Folder)" thread, but I haven't been able to solve the problem.

    ##############################
    AuthType Basic
    AuthName "Members Only"
    AuthUserFile /home/5471/ejpratt/www.example.com/public_html/amember/data/.htpasswd
    AuthGroupFile /home/5471/ejpratt/www.example.com/public_html/amember/data/.htgroup
    Require group PRODUCT_22 PRODUCT_21
    ErrorDocument 401 "Unauthorized"

    ##############################

    I still cannot access the sub directories.

    What am I doing wrong?
  4. ellispratt

    ellispratt New Member

    Joined:
    Jul 30, 2009
    Messages:
    11
    Still stuck

    (deleted by user)
  5. ellispratt

    ellispratt New Member

    Joined:
    Jul 30, 2009
    Messages:
    11
    Still trying

    (deleted by user)
  6. ellispratt

    ellispratt New Member

    Joined:
    Jul 30, 2009
    Messages:
    11
    .htgroup

    (deleted by user)
  7. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Do you have copy of the .htaccess file that was paced by Drupal initially?
    There can be necessary rewrute rules for Drupal. If you have that file copy it content to the .htaccess created by aMember to the top of the file.
  8. ellispratt

    ellispratt New Member

    Joined:
    Jul 30, 2009
    Messages:
    11
    That worked, thank you

    I've copied the content from the original .htaccess file and it worked!
    I needed to copy it before the aMember code, as you suggested. It didn't work if the aMember code was at the top.

Share This Page