Prueba con la siguiente directiva:
always_direct dominio1 dominio2
Eso redirigía el dominio1 al dominio2.
Más información.O sino, con un script en Perl:
Squid can be used a reverse proxy to load balance several web servers, instead of using a hardware load balancer. This is useful because Squid can cache a lot of the content coming from the source web servers, thereby reducing their load. However, it isn't clear how to do an Apache style direct where all hostnames other than
www.hostname.com get redirected to
www.hostname.com. But using a director program it can be straight-forward.
Edit Steps
1.) In Perl write a simple redirector program like this one:
#!/usr/bin/env perl
$|=1;
while (<>) {
$url = m/^([^ ]*)/;
if ($url !~ /^http:\/\/www\.hostname\.com/) {
$url =~ s@^http
://www\
.hostname\
.com
/(.*)@http://www
.hostname
.com
/\
1@; } else {
}
}
2.) In your squid.conf file change the redirect_program variable, it's probably commented out, and specify where your redirector_program is, ex: /usr/sbin/redirect.pl
3.) Make sure that the variable httpd_accel_uses_host_header is set to on, otherwise nothing will be redirected.