Php registration 403 errors

In htaccess, I installed ErrorDocument 403 on some friendly php page, as in:

ErrorDocument 403 http://www.site.com/error/403-forbidden.php

The fact is that I would like to find an easy way to track all the prohibited 403 that occur on the site. So far I have the PHP code to send me an email with their IP address, etc., but what I can not find is what will also tell me how this person got there.

So, for example, in htaccess, I have a rule prohibiting the use of the dollar sign ($) in URLs. So, if I intentionally go: http://www.site.com/ $ I will be redirected to the 403-forbidden.PHP script. Is there a way in this script to register "this person got there because they tried to use $" (or something like that)?

+3
source share
1 answer

On page 403-forbidden.php, you can access the $ _SERVER ['HTTP_REFERER'] variable to check which URL the user tried to go to before ending the error page.

You can register this in your database or send it to your mailing address.

Additional Info About $ _ SERVER

+3
source

All Articles