i created a log class. All works fine and the method "add" appends data to X.log. The problem is, when i turn on htaccess, file_put_contents wrote 2 lines (not one).
Basically, i tryed without class, only writing a file_put_contents in index + htaccess, and ever duplicate the log.
The problem looks like a htaccess routing twice.
This is the minimal code:
index.php:
DEFINE('BASE_PATH',dirname(__FILE__));
DEFINE('DS',DIRECTORY_SEPARATOR);
DEFINE( 'LOG_PATH' , BASE_PATH . DS . "var" . DS . "log" . DS );
file_put_contents(LOG_PATH."1.log", "hola".PHP_EOL, FILE_APPEND | LOCK_EX);
die();
.htaccess code:
Options +FollowSymLinks
IndexIgnore */*
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(var|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
Thanks for help!.