== Usernames with .htaccess == Restricting access to webpages on httpd using a .htaccess file with !AuthType Basic. You need to creat two files, .htaccess and .htpasswd. For an example of .htaccess, please see below. .htpasswd needs to be created on the webserver via "htpasswd passwordfile username", using "-c" will create a new password file. Example: {{{ htpasswd -c /home/SG/cc/public_html/t/.htpasswd johndoe }}} You will be prompted for the password for user "johndoe". See http://httpd.apache.org/docs/1.3/howto/htaccess.html and http://httpd.apache.org/docs/1.3/howto/auth.html for details. For anyone having trouble with this, one possible source of errors is file permissions. If you keep getting an authorization dialog in your browser, but never access, even though you know user and password are correct, check if: 1. the password file exists 1. you have specified the absolute path to the password file 1. the password file can be read by user apache '''Be aware that the password protects versus access via HTTP only, other users on the web server can still read the file on the file system''' === Exemplary .htaccess file === {{{ AuthType Basic AuthName "Some User" AuthUserFile /home/SG/cc/public_html/t/.htpasswd AuthGroupFile /dev/null require user johndoe Options +Indexes IndexOptions FancyIndexing NameWidth=* FoldersFirst }}} === Giving access to a certain IP range only === To restrict access to a web page to a certain range of IP addresses, e.g. IPs of the !CoLi network, you may add the following to the .htaccess file: {{{ Order Deny,Allow Deny from all # Only Coli Allow from 134.96.104.0/23 # UdS-WLAN/VPN and DFKI-SB (no VPN) Allow from 134.96.184.0/24 Allow from 134.96.185.0/24 Allow from 134.96.187.0/24 Allow from 134.96.188.0/24 Allow from 134.96.189.0/24 Allow from 134.96.190.0/24 Allow from 134.96.118.0/24 Allow from 134.96.156.0/22 Allow from 134.96.101.0/24 Allow from 134.96.164.0/23 Allow from 134.96.166.0/23 Allow from 134.96.192.0/22 Allow from 134.96.196.0/22 Allow from 134.96.92.152/28 }}}