I have a Web Application.
All requests to my app will pass to Root/index.php.
Example:
1. http://myapp.com/?call=phpfile1.processSomething¶m1=x¶m2=y
2. http://myapp.com/?call=phpfile2.processSomethingElse
3. http://myapp.com/?call=phpfile3.methodXYZ...
And I have an other app (WindowServices), it will call some Urls in my WebApp (All day :v). When I open access.log, It like this:
[2018-08-07 12:23:43] "GET /?call=phpfile1.processSomething&module=5 HTTP/1.1" 200 16
[2018-08-07 12:23:43] "GET /?call=phpfile2.processSomethingElse&module=2 HTTP/1.1" 200 16
[2018-08-07 12:23:43] "GET /?call=phpfile1.processSomething&module=0 HTTP/1.1" 200 16
[2018-08-07 12:23:43] "GET /?call=phpfile1.processSomething&module=7 HTTP/1.1" 200 16
[2018-08-07 12:23:43] "GET /?call=phpfile2.processSomethingElse&module=4 HTTP/1.1" 200 16
[2018-08-07 12:23:43] "GET /?call=phpfile2.processSomethingElse&module=3 HTTP/1.1" 200 16
And…access.log file will be large file over times.
So, I don’t want Apache loging Urls:
1./?call=phpfile1.processSomething
2./?call=phpfile2.processSomethingElse
I seted some config in vhost file like this:
<VirtualHost *:80>
DocumentRoot "D:MyFolderApp"
<Directory "D:MyFolderApp">
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php index.html
Require all granted
</Directory>
ServerName myapp.com
SetEnvIf Request_URI "^/?call=phpfile1.processSomething" dontlog
SetEnvIf Request_URI "^/?call=phpfile2.processSomethingElse" dontlog
LogFormat "%h %l %u %t "%r" %>s %b" common
CustomLog "logs/myapp.com-access.log" common env=!dontlog
</VirtualHost>
But Apache still write log for these Urls!!!
So, Any one help me!!!
Thanks!
2
Answers
Thanks to Nick and Tarun. I resolved my problem. In my
.htaccess
file, I add some configs:And in my
httpd-vhosts.conf
file, I set like below:So, apache doesn't logging Uris :D
Here in your configuration
SetEnvIf Request_URI "^/?call=phpfile1.processSomething" dontlog
, this line is in formatSetEnvIf attribute regex env-variable
So your regex is “^/?call=phpfile1.processSomething”, in which there are special characters like ‘?’. Escape these characters and change your regex to something like
^/?call=phpfile1.processSomething(.*)
.