Reputation: 157
I've created a hit counted in PHP that saves into a database and the script currently only runs when you navigate to the page where the script is, what I'm wanting to do it make it so every time my page loads it runs the script. I belive I have to do this in the .htaccess file bit i'm not to sure on how.
Here is my current .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{HTTP_HOST} !^www\.giantnodes\.com [NC]
RewriteRule ^(.*)$ http://www.giantnodes.com/$1 [R=301,L]
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
Upvotes: 1
Views: 5593
Reputation: 91734
You can use auto_prepend_file
to run a script every time before the requested script runs.
You can set that in the php.ini
file or in the .htaccess
file.
For .htaccess
you can add something like this:
php_value auto_prepend_file "/path/to/your/file.php"
Upvotes: 11