I want to know if it's possible to redirect or block HTTP traffic with a string like this command on linux :
iptables -A OUTPUT -p tcp -m string --string "STRING" -j REJECT
I am not sure I understand the question.
1) If the question is is there iptables in Mac?, the answer is yes, just use this link.
2) if the question is is this correct? then the answer is not completely: why would you want to use REJECT instead of DROP? According to the Man page for iptables,
Do you really need the error packet?
3) The last point is: is iptables the correct instrument for Web filtering? Here the answer is most likely not. iptables is for firewalling udp/tcp traffic. If you want to do Web filtering, look at squid, privoxy,...
If however you prefer to do it this way, then the grammar of the command is well exemplified by a post on a sister site, here (see the second reply).