.htaccess Rewrite

One .htaccess File

http://www.farinspace.com/codeigniter-htaccess-file/

Regular expressions

  • ^ begins the line to match.
  • $ ends the line to match. So, ^folder1$ matches folder1 exactly.
  • . stands for “any non-whitespace character” (example: a, B, 3).
  • * means that the previous character can be matched zero or more times. So, ^uploads.*$ matches uploads2009, uploads2010, etc.
  • ^.*$ means “match anything and everything.” This is useful if you don’t know what your users might type for the URL.
  • () designates which portion to preserve for use again in the $1 variable in the second string. This is useful for handling requests for particular files that should be the same in the old and new versions of the URL.