You can do this with Squid by using a
redirector.
I used this one back in the day to make sure HTTPS would always be used for Gmail:
Code:
#!/usr/bin/perl
$|=1;
while (<>) {
@X = split;
$url = $X[0];
if ($url =~ /^http:\/\/gmail\.google\.com/) {
print "302:https:\/\/gmail\.google\.com\n";
}
elsif ($url =~ /^http:\/\/www\.gmail\.com/) {
print "302:https:\/\/gmail\.google\.com\n";
}
elsif ($url =~ /^http:\/\/gmail\.com/) {
print "302:https:\/\/gmail\.google\.com\n";
}
else {
print "$url\n";
}
}
I don't know Perl, I just based it off of an example I got from the Squid documentation.
It should be fairly easy for you to modify it to your needs.