vi /usr/local/bin/rewrite.php
01 #!/usr/bin/php
02 <?php
03 $temp = array();
04 while ( $input = fgets(STDIN) ) {
05 // Split the output (space delimited) from squid into an array.
06 $temp = split(' ', $input);
07 // Set the URL from squid to a temporary holder.
08 $output = $temp[0] . "\n";
09 // Check the URL and rewrite it if it matches foo.example.com
10 if ( strpos($temp[0], "google.com") !== false && strpos($temp[0],
"q=") !== false ) {
11 $output = $temp[0] . "&safe=strict\n";
12 }
13 echo $output;
14 } ?>
chmod +x /usr/local/bin/rewrite.php
vi /etc/squid/squid.conf
url_rewrite_program /usr/local/bin/rewrite.php
service squid reload
Received on Sun Jun 24 2012 - 20:22:30 MDT
This archive was generated by hypermail 2.2.0 : Mon Jun 25 2012 - 12:00:03 MDT