Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
What package did you use to install apache? –  Andy Aug 25 '09 at 16:06
add comment

4 Answers

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

share|improve this answer
    
AccessFileName is not set at all in httpd.conf The default for this file is .htaccess –  Anonymous Aug 25 '09 at 17:45
add comment

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.

share|improve this answer
    
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 '09 at 1:06
add comment

What version of windows?

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

share|improve this answer
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 '09 at 17:47
    
I realize I didn't answer your question. This is on Windows XP. –  Anonymous Aug 25 '09 at 17:47
add comment

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.

share|improve this answer
    
I'm putting mod rewrite code into .htaccess The code I'm trying to place works on a different server –  Anonymous Aug 25 '09 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. –  Sean Staats Aug 26 '09 at 14:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.