Home / Localhost / Test .htaccess

How to test if .htaccess is working (Apache, 500 error check)

Check whether Apache reads your .htaccess file, why it is ignored when AllowOverride is None, and how to find the line behind a 500 error.

Apache only reads .htaccess when the server allows it. The default is AllowOverride None, which means the file is ignored completely. A quick test tells you in one request whether the file is being read at all, so you know if the problem is the server or your rules.

A two-minute test

  1. Put a .htaccess file in the folder you want to test (create it if it does not exist).
  2. Add one line of nonsense, for example TestMe, and save.
  3. Reload a page from that folder in your browser.
  4. If you get a 500 Internal Server Error, Apache is reading the file. Your server allows .htaccess, so remove the test line and look at your real rules.
  5. If the page loads normally, Apache is ignoring the file. AllowOverride None is almost certainly in effect, so allow it (below) and test again.

What the result means

The page loads normally with TestMe in the file
Apache is not reading .htaccess. In the server config, set AllowOverride All inside the <Directory> block for your site, then reload Apache. The Apache docs give <Directory "/www/htdocs"> AllowOverride All </Directory> as the example.
500 error with your real rules
Read the Apache error log. The docs give two causes: the directive is not allowed in .htaccess or AllowOverride is set too low (the log says, for example, DirectoryIndex not allowed here), or there is a syntax error (for example RewriteCond: bad flag delimiters).
Changes do not seem to apply
Apache loads .htaccess on every request, so you do not need to restart for changes in the file itself. Clear your browser cache if you changed a redirect, because browsers remember permanent (301) redirects. Changes to AllowOverride in the main config do need a reload.
Nothing happens on nginx
nginx does not read .htaccess files at all. Use nginx config instead; see the nginx redirect generator.
A rewrite rule gives an error about an unknown command
The module for that directive is not enabled on your server. Enable it (mod_rewrite for rewrite rules) and reload Apache.
Why Apache suggests avoiding .htaccess
When it is allowed, Apache checks every folder on the path for the file on each request, so the main server config is faster. Use .htaccess when you cannot edit the main config, as on shared hosting.

Questions about Test .htaccess

Does .htaccess apply to subfolders?
Yes. Directives in a .htaccess file apply to its folder and all folders below it. A deeper .htaccess can override settings from above.
Where do I put the .htaccess file?
In the folder it should affect, usually the web root of the site. The file name starts with a dot and has no extension.
How do I know my host allows .htaccess?
Run the TestMe test above. A 500 error means it is read; a normal page means it is ignored.
Is there a tool that checks .htaccess rules for me?
Not one that can run your real server. Only Apache itself shows how your rules behave. Our .htaccess generator builds the common rules for you.

Updated 2026-10-24

Config generators for this

Related pages