Jump to main content
University Computer Centre
Server Settings - Individual Files

Server Settings for Individual Files

The special instructions in the .htaccess file usually apply to all files in this directory and all subdirectories. With these instructions, the effect can be limited to individual files.

<Files file_name>
    ...
</Files>

This allows you to set WWW settings for individual files - ... stands for any instructions for access protection or other settings. With * and ? simple patterns are also possible, e.g. <Files *.html> ... - all HTML files.

<Files ~ "regular expression">
    ...
</Files>

This can be used to specify the relevant files using complex regular expressions, e.g. <Files ~ ".+\.(html|htm)$"> ... - all files, that end with .html or .htm.

Example: The files in the dir25 directory should be accessible as follows:
  • index.html - publicly (this is default)
  • intern.html - only TU Chemnitz
  • text.gif (and other images) - for TU members only

.htaccess -File in dir25 directory contains:

<Files intern.html>
    ... only applies to the file intern.html
</Files>

<Files ~ ".+\.(jpg|gif)$">
    ... is a regular expression: applies to all files wit the file extension .gif and .jpg
</Files>
Result: index.html, intern.html, text.gif