University Systems help centre

Restrict access to your website: Windows

By default, UVic web spaces are visible to the public. For security reasons, you may want to restrict access to your personal website.

These restrictions will make an authentication box appear when visitors navigate to your website (the appearance may differ depending on your web browser).

authentication pop-up

Part 1: Create your .htpasswd file

1. Go to

2. Type in the username and password you wish to provide access to your website, and click the Add User button. 

create hashed password

3. Open a text editing application, such as Notepad, and copy and paste the line of text generated into your text file.

copying hashed password

4. Repeat Steps 2-4 with any usernames you would like to have access to your website, adding each on a new line of the text file.

.htpasswd file format

5. Save your file as .htpasswd. For the Save as type, select All Files.

6. Upload the file (using an SFTP client) to the data folder.

Part 2: Create your .htaccess file

1. Open a text editing application, such as Notepad.

2. Copy-Paste the following text:

AuthType Basic
AuthBasicProvider file AuthName "Restricted to UVic Username" AuthUserFile /home/NetlinkID/data/.htpasswd Require valid-user UsernameA UsernameB UsernameC
  • Instead of NetlinkID in AuthUserFile use your own Netlink ID.
  • Instead of typing UsernameA UsernameB and UsernameC, type the Username(s) that may access your site.
  • You may change the text Restricted to Username to anything you wish to appear in the login dialogue.

3. Save your file as .htaccess. For the Save as type, select All Files.

4. Upload the file (using an SFTP client) to the folder that you wish to protect. All subfolders will be protected. If you wish to protect your entire site, upload the file to the www folder.

5. Check the permissions to .htaccess. They should be set to 744 to allow read access. To view the file, click on View-> Show Hidden Files. Select the file and click Get Info -> Permissions. 

Cyberduck Get Info

.htaccess unix permissions