0

I've installed Apache on Windows. In my httpd.conf file, I've set AllowOverrides to All. I've placed a .htaccess file in my DocumentRoot directory, but it is not being read. I know it's not being read because if I add the contents directly to my httpd.conf file they are being read. What else am I missing?

1
  • 1
    What package did you use to install apache?
    – Andy
    Aug 25, 2009 at 16:06

4 Answers 4

2

Check your httpd.conf to make sure that the AccessFileName directive is set to .htaccess

1
  • AccessFileName is not set at all in httpd.conf The default for this file is .htaccess
    – Anonymous
    Aug 25, 2009 at 17:45
1

one thing that you're missing is that it's much better to put such rules into httpd.conf rather than in .htaccess. it is extra work for the server to have to search for, open, and read .htaccess files in the current dir and in every parent dir back up to the DocRoot. a small amount of extra work, but it adds up when it happens on every request.

the best rule of thumb is to only use .htaccess when you DON'T have write access to httpd.conf. otherwise disable htaccess entirely and put all your configuration into httpd.conf.

1
  • I agree with you, but I'm trying to make my development environment match my production environment, where I will NOT have access to httpd.conf
    – Anonymous
    Aug 26, 2009 at 1:06
0

What version of windows?

On windows XP at least, .htaccess isn't a valid file name, because it starts with a '.'

2
  • 2
    You cannot rename a file to .htaccess because the filename start with a '.' Instead, you have to use notepad or a similar program to write the file. The file name is valid however.
    – Anonymous
    Aug 25, 2009 at 17:47
  • I realize I didn't answer your question. This is on Windows XP.
    – Anonymous
    Aug 25, 2009 at 17:47
0

Make sure the directives you are trying to put in your .htaccess file are valid within the .htaccess context. Go to the Apache 2.2 Directive Quick Reference page and verify that each of the directives you want to put in .htaccess is valid in that context. I suspect you are trying to use a directive that is not valid in .htaccess, which is why it works when you put it in httpd.conf.

2
  • I'm putting mod rewrite code into .htaccess The code I'm trying to place works on a different server
    – Anonymous
    Aug 25, 2009 at 21:30
  • If you haven't already, set LogLevel to debug, then look for clues in the log file. Please let us know if you find anything interesting there. Aug 26, 2009 at 14:19

You must log in to answer this question.