-
-
Save gali1/d17a8e574386c949fd1f6a84746fa1f0 to your computer and use it in GitHub Desktop.
PHPRedirect helper for squid proxy server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/php | |
| # Squid URL Rewrite program : Codes picked from the internet. | |
| <?php | |
| $temp = array(); | |
| // Extend stream timeout to 24 hours | |
| stream_set_timeout(STDIN, 86400); | |
| 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.animen.com.tw/i", $temp[0])) { | |
| $output = "301:https://www.google.com.sa/\n"; | |
| } | |
| echo $output; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment