Rules for enforcing Google HTTPS SafeSearch

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 4
Joined: 01 May 2014, 21:36

Rules for enforcing Google HTTPS SafeSearch

01 May 2014, 21:41

Hi all,

I've currently got SafeSearch being enforced for Google HTTP traffic (web searches, image searches etc) for our users, but if they use HTTPS (e.g. encrypted.google.com or https://www.google.co.uk etc ...) they are able to disable the SafeSearch option.

The rules I am using at the moment to enforce SafeSearch is as follows:

Code: Select all
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]

RewriteHeader X-Rewrite-Url: .* $1

#Enalbing Safe Search
RewriteRule (.*)?google\.co(.*/images[^?]*)(\?.*)?  $1google.co$2(?3$3&:\?)safe=strict [I,L]
RewriteRule (.*)?google\.(.*/images[^?]*)(\?.*)?  $1google.$2(?3$3&:\?)safe=strict [I,L]

#Force safe Search to images in default google search pages
RewriteRule (.*)?google\.co(.*/search[^?]*)(\?.*)?  $1google.co$2(?3$3&:\?)safe=strict [I,L]
RewriteRule (.*)?google\.(.*/search[^?]*)(\?.*)?  $1google.$2(?3$3&:\?)safe=strict [I,L]

#Force safe Search to images in Bing
RewriteRule (.*)?bing\.co(.*)?(/images[^?]*)(\?.*)? $1bing.co$2$3$4&adlt=strict [I,L]
RewriteRule (.*)?bing\.co(.*)?(/search[^?]*)(\?.*)? $1bing.co$2$3$4&adlt=strict [I,L]

# Youtube Safe Search
RewriteCond URL .*youtube\.com.*
RewriteHeader Cookie: (.*) PREF=f2=8000000
RewriteRule (.*)?youtube\.com(.*\?.*) $1youtube.com$2&safety_mode=true [I,L]


What do I need to add to my httpd.ini file to enforce SafeSearch for Google HTTPS/SSL traffic?

Any help would be greatly appreciated.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rules for enforcing Google HTTPS SafeSearch

05 May 2014, 06:40

Hello,

Please try to add the following condition:

#Enalbing Safe Search
RewriteCond %HTTPS (.*on.*)?
RewriteRule (.*)?google\.(.*/images[^?]*)(\?.*)? (?1https\://)$2google.$3(?4$4&:\?)safe=strict [I,L]

If it works for this rule, put it before the rest of the rules.
BTW, you need only the second rule in #Enalbing Safe Search and #Force safe Search to images in default google search pages sections, as the second rule is more general than the first one and includes the first one.

User avatar
Posts: 4
Joined: 01 May 2014, 21:36

Re: Rules for enforcing Google HTTPS SafeSearch

06 May 2014, 21:32

Hi Anton,

Thanks for the reply!

I tried the code you supplied in your post but it still isn't enforcing SafeSearch.

Since Google switches between using /images and /search in the URL I attempted to change /images to /search in the code but that also had no effect. Afterwhich I stripped out the rest of the rules from my OP from the httpd.ini file so I only had the following, which doesn't work:

Code: Select all
[ISAPI_Rewrite]

# Defend your computer from some worm attacks
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]

RewriteHeader X-Rewrite-Url: .* $1

#Enabling Safe Search for /images
RewriteCond %HTTPS (.*on.*)?
RewriteRule (.*)?google\.(.*/images[^?]*)(\?.*)? (?1https\://)$2google.$3(?4$4&:\?)safe=strict [I,L]

#Enabling Safe Search for /search
RewriteCond %HTTPS (.*on.*)?
RewriteRule (.*)?google\.(.*/search[^?]*)(\?.*)? (?1https\://)$2google.$3(?4$4&:\?)safe=strict [I,L]


In case it has any relevence I am running this plugin using ISA Server 2006.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rules for enforcing Google HTTPS SafeSearch

12 May 2014, 06:03

Hello,

Can you please a specific example of an https URL with SafeSearch that will work when accessed directly?
Then I will make ISAPI_Rewrite generate it.

User avatar
Posts: 4
Joined: 01 May 2014, 21:36

Re: Rules for enforcing Google HTTPS SafeSearch

13 May 2014, 09:55

Hi Anton,

Thanks again for the reply!

I hope this is what you're after.

There are a number of variants for Google searches. In all searches I searched for testString. As you can see I'd like to match any of Google's country TLDs(.com, .co.uk, .com.au, etc ...)

Google web search
https://www.google.com/search?q=testStr ... 2&dpr=1.88
https://www.google.com.au/?gws_rd=cr&ei ... afe=active
https://www.google.com.au/webhp?sourcei ... afe=active
https://www.google.com.au/#q=testString&safe=active

Below is an example using the Advanced Search functionality of Google's web search
https://www.google.com/search?as_q=test ... as_rights=

I'll have to make a second post due to the 5 URL limit on posts.

User avatar
Posts: 4
Joined: 01 May 2014, 21:36

Re: Rules for enforcing Google HTTPS SafeSearch

13 May 2014, 09:56

Google Images search
https://www.google.com/search?safe=acti ... MFvk2Ba1ds


Below is an example using the Advanced Search functionality for Google Images
https://www.google.com/search?as_st=y&t ... as_rights=

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rules for enforcing Google HTTPS SafeSearch

14 May 2014, 05:48

Hello,

So, generally speaking, you need to append any of the URLs that you provided in the last post with "safe=strict", right?
And it should work both via HTTP and HTTPS, correct? And HTTPS is failing at the moment?
Can you see any errors in httpd.parse.errors file in ISAPI_Rewrite installation folder?

User avatar
Posts: 1
Joined: 11 Jun 2014, 17:16

http://www.angerennu.nl/category/hollister-athletic-shorts-m

11 Jun 2014, 17:17

wkcik mmxqz
ltyap jeaqc
zzbfp oxahu
ysrwz ejidz
cmmst aohpx
lfsmc rsugh
lxsmr uutht
hollister abbigliamento
atvef lgxlv
ehjbh defuj
wjzze ykanm
sweater hollister
dlhfk memij
nuale xkjef
jbtcb jiamf
hogan via montenapoleone
moqpf dmtod
dbrzp pjhxs
dmcem uedrp
hollister athletic shorts-men
mooyp xhazp
kkhpa egnol
byuva lxfhi
cheap new nike air max 90
woqex hpqqk
swhrg jxirz
rmoiy nospi
wcqkf pwsea
qkfyj getri
yrhkd cwskh
zgbma yjhic
sdbfp vvqvh
sdzxz gidun
tjmup hclxu

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 8 guests