====== Customizing htaccess ====== Notes on htaccess file (apache web server configuration file) ===== General ===== * use # for comments (beginning of line only) ===== rewrite mod ===== RewriteRule pattern substitution [flags] * pattern: regex match against url * substitution: full url (can be another domain?) * a dash (-) means ignored (do nothing) * flags: case insensitive, comma-separated, may have args * L|last: stop evaluate other rules (if matched) * C|chain: chained (subsequent rules) skipped if first not matched * E|env: {set (E=VAR:VAL) or unset (E=!VAR) } environment variable * F|forbidden: returns 403 (L implied) * N|next: restart ruleset from top (caution: can cause infinite loop!) * NC|nocase: case-insensitive rule matching * QSA|qsappend: if subs contains query (?), append original (default:discard) RewriteCond teststring pattern [flags] * if present, must match for the following rule to be aplied * teststring: server/env variables, HTTP_HOST, REQUEST_URI, etc. * pattern: condition, usually a regex; can use a file attribute test * flags: optional, special actions