This is a dumb question, but is there a syntax specification for the Apache .htaccess file format?

All I can find are "tutorials", that is not what I want.

What I want is a list of all the valid keywords that will be recognized in a .htaccess file and what all the valid parameters and functions are. Does this exist?

3 Answers 3


.htaccess is a way to put a <Directory> specification inside a file which is in this directory.

So every Apache documentation settings that is tagged as available at a Directory Levels is available on a .htaccess. Fore example take a look at ErrorDocument documentation you have in the main box a Context settings, here we can see this context contains 'Directory', so it's available on a .htaccess. That means as well that if you have access to apache configuration it's better in term of performances to use a <Directory /my/dir> section than a .htaccess in /my/dir. As you could forbid .htaccess and avoid file system reads. When you use .htaccess files Apache is looking for a .htaccess in your directory and all parent directories.

Now, I just said you can forbid .htaccess files, you do that with:

AllowOverride None

Which means .htaccess files cannot override any configuration setting (and Apache will stop looking for these files on the filesystem). AllowOverride can take other values, and that mean some of the available settings won't be available in your .htaccess if the apache admin do not want you to break everything.


for a quick reference, which is the main point, you have this table in apache documentation, where all directives are listed, check the 'd' for directory, and you have your .htaccess reference.


an .htaccess file takes pretty much a good chunk of whatever your main apache config can take. I doubt there is going to be a page that lists everything that can go in one. Pretty much any module you can load into apache, you can use that module's config in a .htaccess file.


.htaccess files provide a way to make configuration changes on a per-directory basis.

In general, .htaccess files use the same syntax as the main configuration files.

Apache configuration files contain one directive per line. The backslash "\" may be used as the last character on a line to indicate that the directive continues onto the next line. There must be no other characters or white space between the backslash and the end of the line.



  • Copy/paste much?
    – EEAA
    May 28, 2011 at 3:01
  • .......Yea, so?
    – dmourati
    May 28, 2011 at 3:37
  • Well - it's not your answer. You're taking material written by another organization and passing it off as your own. That's not acceptable. If you're going to copy/paste, at least come out and acknowledge that you're doing so and give attribution where appropriate.
    – EEAA
    May 28, 2011 at 3:40
  • Where do you get your information from?
    – dmourati
    May 28, 2011 at 3:43
  • What information?
    – EEAA
    May 28, 2011 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.