Eibo - Sistemas Web
Eibo - Sistemas Web

Reputation: 179

How to configure .htaccess to run a php script whenever someone accesses the site?

I need to configure the .HTACCESS file so that every time someone accesses any file or directory of the site, a php script is executed and this script is informed of the requested file (sent to the browser). What is the simplest way to accomplish this? I need to create an access statistics table, using data from the IP that it accesses. On the sites I created, I simply put on each page a call to the database record. But on this occasion, I'm dealing with a Word Press site. That's a lot of files, and I would not dare change them. Therefore I intend to use this method: Have HTACCESS collect the request data and run the php script that will register the DB.

Upvotes: 1

Views: 358

Answers (1)

Al.UrBasebelon Tomeh
Al.UrBasebelon Tomeh

Reputation: 301

Add this to your .htaccess file, replacing /path_to_file/file.php with your file's path

php_value auto_prepend_file "/path_to_file/file.php"

Upvotes: 2

Related Questions