LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 03:10 AM   #1
sunlinux
Member
 
Registered: Feb 2006
Distribution: RHCL 5
Posts: 226

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, 03:26 AM   #2
mario.almeida
Member
 
Registered: May 2008
Location: India
Distribution: Ubuntu 10.04, CentOS
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:06 PM
Squid NTLM and Redirect help InEeDhElPlInUx Linux - Server 0 10-31-2007 12:18 PM
Squid redirect butchybro Linux - Networking 0 06-04-2005 06:06 AM
Another squid redirect problems wylie1001 Linux - Software 2 10-02-2004 01:29 AM
Redirect ICQ to Squid Padre Linux - Software 0 12-18-2003 08:29 AM


All times are GMT -5. The time now is 01:25 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration