LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-15-2010, 02:10 AM   #1
sunlinux
Member
 
Registered: Feb 2006
Distribution: RHCL 5
Posts: 239

Rep: Reputation: 30
domain redirect squid


I want to redirect domain using squid:

like if I type www.yahoo.com it take me to www.google.com at client side

pls input on above I have already tried squirum but that's no gain.
 
Old 03-15-2010, 02:26 AM   #2
mario.almeida
Member
 
Registered: May 2008
Location: India
Distribution: Ubuntu 10.04, CentOS, Manjaro
Posts: 179

Rep: Reputation: 27
Hi,

May be you can try it with url_rewrite_program

=====squid.conf====
url_rewrite_program /usr/sbin/url_redirect.php
url_rewrite_children 5


====/usr/sbin/url_redirect.php=======
#!/usr/bin/php
<?php

$temp = array();

while ( $input = fgets(STDIN) ) {
// Split the output (space delimited) from squid into an array.
$temp = split(' ', $input);

// Set the URL from squid to a temporary holder.
$output = $temp[0] . "\n";

// Clean the Requesting IP Address field up.
$ip = split('/',rtrim($temp[1], "/-"));

if (preg_match("/^http:\/\/www.yahoo.com/i", $temp[0])) {
$output = "301:http://www.google.com\n";
}

echo $output;
}
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid how to redirect url gubak Linux - Networking 3 03-04-2010 02:06 PM
Squid NTLM and Redirect help InEeDhElPlInUx Linux - Server 0 10-31-2007 11:18 AM
Squid redirect butchybro Linux - Networking 0 06-04-2005 05:06 AM
Another squid redirect problems wylie1001 Linux - Software 2 10-02-2004 12:29 AM
Redirect ICQ to Squid Padre Linux - Software 0 12-18-2003 07:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration