Dismiss Notice
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

Restricted Pages?

Discussion in 'General Webmaster Helpdesk' started by gotlinks, Oct 30, 2007.

  1. gotlinks

    gotlinks New Member Webmaster

    Want to know how to restrict people from viewing some of your web pages.


    You can do it with the .htaccess file (I'll assuming you are running Apache since it's on Linux).


    1. create file

    content of .htaccess:

    AuthName "Restricted"
    AuthType Basic
    AuthType Basic AuthUserFile /serverpath/to/your/restricted/dir/.users
    require valid-user

    2. then via telnet - login to your server and execute the following commandline

    htpasswd -c .users [user to add]

    --->> replace "[user to add]" by actual user name WITHOUT [] - then prompt for password will appear twice !
    this for FIRST user, then ...

    3. to add NEW additional users proceed as follows:

    each ADDITIONAL user execute the following (slightly different commandline)
    IF for any reason the file .user is NOT created by the first htpasswd -c .users [user to add] command,
    then create it by using

    touch .user

    or any other means you know

    to ADD additional users - execute the following commandline via telnet

    htpasswd .users [user to add]

    --->> replace "[user to add]" by actual user name - then prompt for password will appear twice !

    PLEASE note
    all passwords are ONE-way encrypted
    YOU have to remember the passwords
    else if password LOST
    ftp to your server - open .user-file in editor - and delete the one user you forgot password and re-enter same user again ...

    the .users - file then has a content per user similar to


    first part being username - second part encrypted password

    why to restrict access

    1. ask shawn - the site access to Keyword tracker is restricted
    2. i have it on my download page

    i offer free download ( sometimes free and sometimes for honest donation )
    1 most frequent downloaded file has some 14+ MB
    i get MANY hundreds of downloads/months IF i offer that file for free - but even more hundreds of ABORTED downloads each months ..
    with zero restriction i could easily exceed my monthly limits of 25 GB - all would be out of control.

    people love to grab whatever is free even if they have no use for it ... just for GREED ...
    and as soon as they realize that it would cost them some cents for their own download time charged by their own ISP
    - they abort
    leaving nothing but serverload for nothing - wasted resources - aborted download sometimes makes up to some 90% of download volume on THAT file's total volume.

    3. in forum etc restricted access keeps people who have OTHER than honest intentions most of the time out as they fear submitting
    name or email address

    hence i restrict access to a few sections to keep all as clean as possible and fully focus on productivity.
    it works since many years.
  2. Scripter

    Scripter New Member Webmaster

    Ah yes, the creation of restricted files.
    Very usefull.

Featured Resources (View All)

Share This Page