From: Fabian K. <fk...@fa...> - 2011-03-27 16:58:40
|
Jeroen van der Wal <je...@st...> wrote: > I'm still struggeling on this but will investigate more time to accomplish > this. TMHO the -redirect is not working. Can't find any documentation on in > either. The minus sign isn't specific to the redirect action but works for all actions. It's documented at: http://www.privoxy.org/user-manual/actions-file.html#ACTIONS > Here's a link to my final goal: > http://www.google.com/support/websearch/bin/answer.py?hl=en&answer=186669 Using the "3. Explicitly disable the redirect action for the rewritten URL." approach: # Redirect search requests on www.google.com to the same URL with "&safe=active" appended {+redirect{s@$@&safe=active@}} # Redirected URL = http://www.google.com/search?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche # Redirect Destination = http://www.google.com/search?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active # Level = 123 # Redirected URL = http://www.google.com/s?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche # Redirect Destination = http://www.google.com/s?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active # Level = 123 .google.com/s(earch)?\? # Make an exception for the URLs that already have it at the end to prevent redirection loops. {-redirect} # Sticky Actions = -redirect # URL = http://www.google.com/search?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active # Level = 123 # URL = http://www.google.com/s?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active # Level = 123 .google.com/s(earch)?\?.*&safe=active$ The comments with the equal signs are ignored by Privoxy itself, but allow Privoxy-Regression-Test to verify that it is working as expected (provided the tests themselves are correct): fk@r500 ~/git/privoxy $privoxy-regression-test.pl --verbose --level 123 --max-level 123 2011/03/27 18:54:36: Asking Privoxy for the number of action files available ... 2011/03/27 18:54:36: Gathering regression tests from 9 action file(s) delivered by Privoxy. 2011/03/27 18:54:36: Executing regression tests ... 2011/03/27 18:54:36: Success for test 0/424/8/21. Redirected URL: 'http://www.google.com/search?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche' and redirect destination: 'http://www.google.com/search?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active' 2011/03/27 18:54:36: Success for test 1/425/8/22. Redirected URL: 'http://www.google.com/s?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche' and redirect destination: 'http://www.google.com/s?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active' 2011/03/27 18:54:36: Success for test 2/426/8/23. Sticky Actions: '-redirect' and URL: 'http://www.google.com/search?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active' 2011/03/27 18:54:36: Success for test 3/427/8/24. Sticky Actions: '-redirect' and URL: 'http://www.google.com/s?sclient=psy&hl=de&site=&source=hp&q=test&btnG=Google-Suche&safe=active' 2011/03/27 18:54:36: Executed 4 regression tests. Skipped 732. 4 successes, 0 failures. URLs that already contain the "&safe=active" somewhere else will still be redirected once, but you could prevent that by removing the '$' sign for the second section. I kept it, as I don't know if Google allows to override "&safe=active" with something like "&safe=off" later on in the same URL. If it doesn't seem to work for you, I'd suggest you enable logging to figure out what's going on. Redirects have their own debug directive: http://www.privoxy.org/user-manual/config.html#DEBUGGING > PS Here's an article mentioning Privoxy as best Linux content filter: > http://www.techradar.com/news/software/applications/6-of-the-best-content-filters-for-linux-698307?artc_pg=4 > Keep up the good work! Thanks. Fabian |