Forum Topic: Use .htaccess to filter Ajax calls

Forum: .htaccess Forum : General • Posted by eet • Updated:

I have a chat forum that uses Ajax to send/receive messages. Is it possible to use .htaccess to filter specific types of requests, such as those containing certain words, from a specific IP, of a certain length, and so forth?

1 Reply to “Use .htaccess to filter Ajax calls”

Posted by Jeff Starr

It may be possible depending on how the Ajax script is communicating with the server. In most cases however, the fragment identifier (eg, #whatever) is used through JavaScript and not sent to the server, so the chat requests would not be accessible via .htaccess. In this situation it’s best to let PHP or other scripting language handle processing and filtering of chat activity.