How Do You Password Protect Pages (Think Hostgator)?

7 replies
Hey guys,

I'm starting a subscription newsletter and I want to password protect my newsletter editions so they aren't accessible by people who aren't subscribed.

I just wanted to set up a simple password protect like the one that Hostgator CPanel uses. You know, where you type in the url of your cpanel and a prompt comes up to enter a username and password before it loads the page.

Do you know how to do this? Could you please point me to any resources?

Thank you!
#hostgator #pages #password #protect
  • Profile picture of the author CMartin
    Originally Posted by UndeniableSpirit View Post

    Hey guys,

    I'm starting a subscription newsletter and I want to password protect my newsletter editions so they aren't accessible by people who aren't subscribed.

    I just wanted to set up a simple password protect like the one that Hostgator CPanel uses. You know, where you type in the url of your cpanel and a prompt comes up to enter a username and password before it loads the page.

    Do you know how to do this? Could you please point me to any resources?

    Thank you!
    Maybe this helps you
    HostGator Knowledgebase: Can I password protect directories?

    Carlos
    {{ DiscussionBoard.errors[852177].message }}
  • Profile picture of the author Tim Franklin
    You can use .htaccess which is standard, you can do this yourself, using a text editor and defining your variables in the files, (a little harder)

    Or you can password protect a directory using your Cpanel

    Which is a lot easier,)

    Either way, .htaccess is a good thing to learn about you can do loads of cool stuff with it and it is a skill that few people fully understand so setting about to learn it is something that will separate you from the masses.
    Signature
    Bitcoin | Crypto | AI software tools and development|
    {{ DiscussionBoard.errors[852366].message }}
  • Profile picture of the author stevenh512
    The Cpanel password protected directories just gives you an easy way to deal with .htaccess authentication. In general unless you have SSH access to your server, you can not do standard .htaccess based HTTP authentication by hand in a text editor because the passwords in your .htpasswd file have to be encrypted. The encryption function is OS specific and can even vary between different installs of the same OS in the case of Linux (thanks to pluggable authentication modules and the like). Best bet is to either use Cpanel or use a membership script that automates it for you. There are plenty of membership scripts that will handle the .htpasswd encryption for you by calling the OS specific crypt() function when needed.

    Look for "Membership Site Manager" it's an old PLR membership script that uses .htaccess/.htpasswd authentication for the members area, I'm sure you can find it cheap or free in a number of places.
    Signature

    This signature intentionally left blank.

    {{ DiscussionBoard.errors[853619].message }}
    • Profile picture of the author Tim Franklin
      Actually your mostly right, but there is actually nothing you cannot do with a text editor and the right knowledge,)

      But as we both agree, Cpanel is the easiest way to go in this users specific instance but I like to give people a little more to think about along the way,)

      not sure what the motive was but thanks for posting.:confused:


      Originally Posted by stevenh512 View Post

      The Cpanel password protected directories just gives you an easy way to deal with .htaccess authentication. In general unless you have SSH access to your server, you can not do standard .htaccess based HTTP authentication by hand in a text editor because the passwords in your .htpasswd file have to be encrypted. The encryption function is OS specific and can even vary between different installs of the same OS in the case of Linux (thanks to pluggable authentication modules and the like). Best bet is to either use Cpanel or use a membership script that automates it for you. There are plenty of membership scripts that will handle the .htpasswd encryption for you by calling the OS specific crypt() function when needed.

      Look for "Membership Site Manager" it's an old PLR membership script that uses .htaccess/.htpasswd authentication for the members area, I'm sure you can find it cheap or free in a number of places.
      Signature
      Bitcoin | Crypto | AI software tools and development|
      {{ DiscussionBoard.errors[853905].message }}
      • Profile picture of the author stevenh512
        Originally Posted by Tim Franklin View Post

        Actually your mostly right, but there is actually nothing you cannot do with a text editor and the right knowledge,)
        Now you have me wondering how. I know I have an Apache server on my Windows laptop and when I generate a .htpasswd file with that, the passwords are not compatible with the Apache server running on my Linux hosting account. I'm guessing you'd need more than a text editor and the right knowledge, you'd need access to the crypt() function that your web host's operating system uses (which is why I mentioned having SSH access, you can easily generate an encrypted password from the command line).
        not sure what the motive was but thanks for posting.:confused:
        Was just trying to keep the OP from doing something that might be "over his head" by trying to create the .htaccess/.htpasswd files by hand. It can be done, but not without knowing exactly how passwords on the server are encrypted. Much easier to use cpanel or (if you need it) a membership script.
        Signature

        This signature intentionally left blank.

        {{ DiscussionBoard.errors[853947].message }}
        • Profile picture of the author Tim Franklin
          @steven

          There are various methods but this is really not the venue, and out of respect to the OP since this is his post I will keep this reply short, and if you wish to continue this discussion I would be happy to do so in private since this discussion really is between two opposing points of view, it serves the community no real value for us to engage in techno babble.

          But, here is an example of my point, since you asked, you will find a link to this particular method at the bottom of this post,

          This uses the PayPal Payment Data Transfer (PDT) script and a protected folder that contains the product with a .htaccess and .htpassword file. PDT will allow your customer to reload the page up to five times, this means that they will get five chances to download the product.* It is recommended to use a Cron Job on your host to clear the .htpassword file after 24 hours or you can manually do this, or not worry about it.
          *
          The download folder should be Password Protected, if it is not, anyone will be able to download your products. If you do not know how to set up a password protected page, you can create a file called ".htpassword", this will store your user id and password. You will also need a ".htaccess" file. These two files should be in a separate folder with your downloadable files.

          AuthName "My Downloads"
          AuthType Basic
          AuthUserFile /home/path/to/file/protected/.htpassword
          AuthGroupFile /dev/null
          require valid-user

          PDT digital download script - Post Your Code Samples - PayPal Developer Community
          Signature
          Bitcoin | Crypto | AI software tools and development|
          {{ DiscussionBoard.errors[854006].message }}
  • Profile picture of the author UndeniableSpirit
    I totally forgot I posted this thread until I remembered I needed to do this. Thank you very much for the helpful information guys!
    {{ DiscussionBoard.errors[870949].message }}

Trending Topics