I'm setting up a web server using apache and want to be able to get client's IP and hostname from any page they visit on the website without having to manually implement logging code in all the files.
I heard about .htaccess RewriteRule and tried that but it just redirects me to a page which logs that info as opposed to staying on the same page and automatically logging it in the background.
RewriteEngine On
RewriteRule ^flower.jpg$ info.php
Say I have a page info.php which logs that info and I have some other pages like welcome.html, flower.jpg, contact.html, game.png
What I expect: Whenever welcome.html, flower.jpg, contact.html or game.png is visited I expect info.php to auto load and log client's IP and hostname in the background.
What actually happened: I got redirected to info.php as opposed to staying on the same page(like flower.jpg as shown in the code)
How can I make sure I load info.php using htaccess in the background without getting redirected to it?