Customize Configuration

This service is in the process of being decommissioned and new personal websites can no longer be created. If you are a faculty member or a member of a lab/research group, please see Faculty, Lab and Research Websites (CampusPress) for more information on our new service. For further advice on how to proceed with your website project, please contact

For information on retrieving content or files on your existing personal website, see the instructions on Publishing a Personal Website

.htaccess files provide a way to make configuration changes on a per-directory basis. An .htaccess file is a simple ASCII text file that acts on the directory it is located in and its subdirectories to configure directory level properties of your website.

Features you can add to your website using an .htaccess file:

Password Protecting Resources

  1. SSH to
  2. Navigate to your website root folder
  3. Type the following at the command prompt: htpasswd -c .htpasswd guest. This will create a new file called .htpasswd and add a user - in this case called "guest" (you can use whatever user name you would like).
  4. Next, you will be prompted to enter a password for the username you just created
  5. Create or edit the .htaccess file vi .htaccess
  6. Enter the following information (please replace italicized information with your own)
    • AuthName "Secure Pages"
      AuthType Basic
    • Example:
      AuthName "Secure Pages"

      AuthType Basic
      AuthUserFile /users/u/0/jdoe/.htpasswd
      Require user guest
    • Please note: The password-file-location denotes a full path to the password file, for example, /users/u/0/jdoe/.htpasswd for personal accounts or /www/mysite/.htpasswd for organizational accounts hosted on or You may use the command 'pwd' to find out what your current directory is
  7. Make the .htpasswd and .htaccess file web-readable by setting permissions on both the files: chmod 644 .htaccess chmod 644 .htpasswd
  8. Move your htpasswd file outside of your web accessible folder. For example, if you are securing your personal website, put the file in your home directory. If this option is not available to you (organizational websites), create a password file with an obscure name.
  9. To add more users, or change user passwords, execute the following command: htpasswd .htpasswd guest2


  • If you use FTP to transfer your .htaccess file to the server, make sure the transfer is done in ASCII mode
  • check the permissions for the files, they should be read/write for owner, read for group and read for other; or
  • Check that the path and file name in the .htaccess file (AuthUserFile), matches the actual path to your password file

Back to Top

Custom Error Pages

The most common error is the 404 - Page Not Found error. You can redirect 404 errors to your custom page.

  1. SSH to
  2. Navigate to your website root folder
  3. Create or edit your .htaccess file: vi .htaccess
  4. Add the following: ErrorDocument 404 /orgfolder/error/error404.html

Tip: If you are using password protection, it is a good idea to capture the 403 - Not Authorized error as well by repeating the above steps but substituting 403 for 404.


Back to Top

Redirect Webpages

.htaccess can be used to redirect users to a different URL by using the Redirect command.

There are 3 parts to the syntax: redirect accessed-file URL-to-go-to

  • the Redirect command
  • the location of the file/directory being accessed
  • full URL of file/directory you want to redirect to
  1. SSH to
  2. Navigate to your website root folder
  3. Create or edit your .htaccess file: vi .htaccess
  4. Add one of the following Redirect command depending on your requirements:

Redirecting to Single Page

Redirect /users/u/0/jdoe/public_html/page1.html
Redirect /production/orgfolder/old-dir/oldfile.html

Redirecting Directory

Redirect /production/orgfolder/old-dir/

Tip: There is an Apache Tutorial with more information on configuring and using .htaccess files.


Back to Top