how to enable SSL all over Amember pages

Discussion in 'Setting-up protection' started by marc_etienne71, Jul 18, 2013.

  1. marc_etienne71

    marc_etienne71 New Member

    Joined:
    Feb 18, 2012
    Messages:
    8
    Hi,

    I would like to enable SSL-HTTPS all over my website. I am using wordpress and SSL on wordpress works perfectly. I changed my root links in amember licence to both HTTPS. When logged in in amember, i am in https but the problem is with the login page. The problem is that the admin and user login page are not https.

    How to enable those pages ??

    thank you
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    You should be able to force all visitors to use https by making a change to the root htaccess file.
    Sorry, dont remember the code offhand.

    David
  3. tomingles

    tomingles Member

    Joined:
    Mar 27, 2013
    Messages:
    52
    Hi,

    I have exactly the same issue, and I'm hoping someone can confirm the code change to the root htaccess file you mentioned above David.

    I would like to force my entire Amember website (and Wordpress integration) to use SSL. I have a working SSL certificate, and when I access the pages using https:// everything is working.

    However, if I visit my Amember installation under:

    http://mydomain.com/members

    It remains as http:// and not https:// including when I click through to the following two URLs which are the two I definitely want as https:

    http://mydomain.com/members/login/index
    http://mydomain.com/members/signup/index

    I am using the Wordpress integration plugin and have my Wordpress installation under: http://mydomain.com/secure which seems to all stay as https:// no problem.

    It seems to be that I need to add a redirect rule to the Amember .htaccess file in http://mydomain.com/members, but I'm not sure this is correct:

    Code:
    <IfModule mod_rewrite.c>
        RewriteEngine on
    # You may need to uncomment the following line if rewrite fails to work
    # RewriteBase must be setup to base URL of your aMember installation without
    # domain name
        RewriteBase /members
        RewriteCond %{SERVER_PORT} 80
        RewriteRule ^(.*)$ https://mydomain.com/secure/$1 [R,L]
        RewriteRule ^(.*)$ https://mydomain.com/members/$1 [R,L]
        RewriteRule ^public public.php [L]
        RewriteRule ^js.php js.php [L]
        RewriteRule !\.(js|ico|gif|jpg|png|css|swf|csv|html)$ index.php
    </IfModule>
    Will these two lines insure that all Amember URLs use https?

    Code:
        RewriteRule ^(.*)$ https://mydomain.com/secure/$1 [R,L]
        RewriteRule ^(.*)$ https://mydomain.com/members/$1 [R,L]
    Or because the .htaccess file in question is already in the /members subdirectory, can I only use this redirect on folders contained within the /members subdirectory and therefore the following rewrite rule for https://mydomain.com/secure/ won't work as it is referencing another directory:

    Code:
    RewriteRule ^(.*)$ https://mydomain.com/secure/$1 [R,L]
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    @tomingles you need to set up redirect only for folder with aMember (in case you put it to aMember .htaccess file) and
    it should looks like
    Code:
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://mydomain.com/$1 [R,L]
    Full code will be
    Code:
    <IfModule mod_rewrite.c>
        RewriteEngine on
    # You may need to uncomment the following line if rewrite fails to work
    # RewriteBase must be setup to base URL of your aMember installation without
    # domain name
        RewriteBase /members
        RewriteCond %{SERVER_PORT} 80
        RewriteRule ^(.*)$ https://mydomain.com/$1 [R,L]
        RewriteRule ^public public.php [L]
        RewriteRule ^js.php js.php [L]
        RewriteRule !\.(js|ico|gif|jpg|png|css|swf|csv|html)$ index.php
    </IfModule>
  5. tomingles

    tomingles Member

    Joined:
    Mar 27, 2013
    Messages:
    52
    Thank you Caesar - I tried exactly what you suggested above, but now when I visit http://mydomain.com/members directly, it redirects me to the parent domain but with https - so if I try to access any of these Amember pages:

    http://mydomain.com/members/admin - Admin CP
    http://mydomain.com/members/signup - Signup Page
    http://mydomain.com/members/login - Login Page
    http://mydomain.com/members/member - Member's Page

    I get redirected to https://mydomain.com.

    So I can't access the Amember pages at all.

    I changed the code you suggested above - which is this:

    Code:
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://mydomain.com/$1 [R,L]
    to include the members directory in the rewrite rule like this:

    Code:
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://mydomain.com/members/$1 [R,L]
    And now I think it is working... Can you confirm that this looks correct to you?

    Thanks!
  6. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Yes, it is correct code. I forgot about RewriteBase /members directive.
    tomingles likes this.
  7. tomingles

    tomingles Member

    Joined:
    Mar 27, 2013
    Messages:
    52
    Great thanks again.
  8. mobilenow

    mobilenow New Member

    Joined:
    Jul 17, 2013
    Messages:
    1
    What about if I have aMember installed inside a wordpress installation? There seems to be a conflict with the rewrite and wordpress. Any suggestions?
  9. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    I recommend to install aMember and Wordpress to separate folders to avoid any conflicts. Also you can install aMember to subfolder of folder with Wordpress. It should works as well.
  10. thared33

    thared33 Member

    Joined:
    Dec 11, 2009
    Messages:
    73
    I went into Setup - Global - then changed the Secure Root to https. Isn't that supposed to change everything in the amember folder to https? It doesn't seem to be working.
  11. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    aMember use this setting for payment links but your site still accessible with http:// if user access it directly from his browser.

Share This Page