title: Using Squid proxy server to redirect web request
body: <p>I am trying to set up a squid3 proxy on my laptop.  I am new to all this, I was able to configure my desktop to use the proxy just as a pass through.  The next thing I would like to do is redirect web requests.  I've added this line in my squid.conf file</p>
  
  <pre><code>url_rewrite_program /usr/local/bin/redirect.py
  url_rewrite_children 5
  </code></pre>
  
  <p>The program I have simply returns the web address for Google, for testing purposes. </p>
  
  <pre><code>#!/usr/bin/env python
  
  import sys
  
  while True:
      line = sys.stdin.readline().strip()
      new_url = "301:http://google.com\n" 
      sys.stdout.write(new_url)
      sys.stdout.flush()
  </code></pre>
  
  <p>Now when I use the proxy on my desktop, all web requests are redirected to Google, but it then gets caught in an infinite redirect loop and never actually opens the page. I'm not sure what to try next.  Any help is appreciated.</p>