Add these lines in /etc/squid/squid.conf
acl blacklist url_regex -i “/etc/squid/blacklist.txt”
acl blackpath urlpath_regex -i “/etc/squid/blackpath.txt”
http_access deny blacklist
http_access deny blackpath
Edit /etc/squid/blacklist.txt to block whole URL
http://denysite.com
http://badsite.com/badcontents/
Edit /etc/squid/blackpath.txt to block maching on URL
denyword
badword
After changing these files, you need to reload your squid
/etc/init.d/squid reload