EECS
EECS

DCO > Knowledge Base

Main page | Recent changes | RSS Feed
  
What is a '.htaccess' file and how can I use it in my website?Last updated 01/15/2019 3:16 PM | Print | Show source | History

Our web server runs HTTPD, which allows for the use of '.htaccess' files to control server behavior for your website. To take advantage of this, simply use a text editor to create a filed called '.htaccess' and put it in your '~/public_html' directory. Here are some examples of '.htaccess' file contents:

Redirect to another directory

Redirect /old_dir/ http://www.yourdomain.com/new_dir/index.html

Simple password protection

AuthName "Member's Area Name"
AuthUserFile /path/to/password/file/.htpasswd
AuthType Basic
require valid-user

Where '.htpasswd' is a password file created by running the commmand:

htpasswd -b -c .htpasswd username password

You can always add more users to this file later by running the same command without the '-c' directive. More information on this command can be found here.

Allow access only to users from within the UM network

order allow,deny
allow from umich.edu
deny from all

This is just a taste of the power of '.htaccess' files. For more information, see this page.


Do you need further assistance? We're here to help. Give us a call, send an email, or just stop by one of our offices.

Powered by LionWiki | Admin | Incoming Links