Apache Access Logging With htaccess?

I’m on Go Daddy’s cheap shared hosting plan and I really don’t get any sort of log info. I get some stats, which are really useless. You have to subscribe to their stat package to get better stats.

I created a PHP script that I included into all of my pages to log hits. The problem with that is that it doesn’t log access to graphics, etc.

So I was wondering if there is a way to configure logging in htaccess (assuming for the moment Go Daddy allows it) so that I can log access to anything in my user directory. Basically, I was hoping I could put a htaccess file in my document root and it would log all hits to all pages and graphics in my website.

Is this possible? I’ve searched Yahoo and Google and didn’t find anything to help me. So I come to the experts seeking advice.

Thanks for you help.

I’ve searched Yahoo and Google and didn’t find anything to help me.

It amazes me that people keep going to search engines before the manual, especially when Apache has incredible documentation.



Actually, when I searched Yahoo the Apache documentation was at the top of the list. And I did read it–I just didn’t understand it.

I tried putting this, and several variations of, into a htaccess file:

CustomLog path/to/logfile.log “%h %l %u %t \”%r\" %>s %b \“%{Referer}i\” \“%{User-agent}i\”"

I got nothing but errors. I also tried putting in an AllowOverride statement first. But that statement looks like it is for configuring the main server and not my folder.

Context: server config, virtual host


What Linh was saying with that was that Apache.org specifies that your command string MUST be in the server configuration OR VirtualHost section of httpd.conf.