DocumentRoot /home/username/public_html ServerName yourdomain.com ServerAlias *.yourdomain.com $ cat /home/username/public_html/.htaccess RewriteCond %{HTTP_HOST} ^yourdomain.com$ RewriteRule ^(.*) http://yourdomain.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^yourdomain.com$ RewriteCond %{REQUEST_URI} !^/browse.php RewriteCond %{REQUEST_URI} !^/robots.txt$ RewriteRule .* /browse.php [L] issues -certificate error (in IE even after install as root CA) -login in to gmail should be implemented -multipart/form-data (file upload) is implemented -cookies (should be optional?) -dns proxy -https (optional) -x-forwarded-for header (should be optional?) should (probably) not be implemented -crossdomain policy file -banner replacement (adsense) buss model? */ function parse_headers($lines) { $headers = array(); while (count($lines)>0) { $line = trim(array_shift($lines)); if ($line=='') break; $seppos = strpos($line,':'); $name = trim(substr($line,0,$seppos)); $value = trim(substr($line,$seppos+1)); if ($headers[$name]) { if (!is_array($headers[$name])) { $headers[$name] = array($headers[$name]); } array_push($headers[$name],$value); } else $headers[$name]=$value; } return $headers; } function parse_chunked($chunked) { $data = ''; $startpos = 0; while ($startpos$status,'headers'=>$headers,'data'=>$data); } function strends($string,$suffix) { return substr($string,-1*strlen($suffix))==$suffix; } function add_warning($matches) { return $matches[1].'
Notice: You are visiting this site through the Proxy
'; } function url_rewrite($matches) { if ($_COOKIE['dontcensorme_ssl']) $matches[1]='https'; $url = $matches[1].$matches[2].$matches[3]; if (!strends($url, PROXY_SUFFIX)) $url.=PROXY_SUFFIX; return $url; } function domain_rewrite($matches) { $url = $matches[1].$matches[2].$matches[3]; if (!strends($url, PROXY_SUFFIX)) $url.=PROXY_SUFFIX; return $url; } function rewrite($data) { $data = preg_replace_callback('/(]*>)/i','add_warning',$data); return preg_replace_callback('/(https?)(:\/\/)([0-9a-zA-Z\.\-]+)/','url_rewrite',$data); } function rewrite_cookie($data) { return preg_replace_callback('/(domain)(=)([0-9a-zA-Z\.\-]+)/i','domain_rewrite',$data); } $method = trim(strtoupper($_SERVER['REQUEST_METHOD'])); $scheme = ($_SERVER['HTTPS']?'https':'http'); $host = $_SERVER['HTTP_HOST']; $requri = $_SERVER['REQUEST_URI']; if ($scheme=='http' && $_COOKIE['dontcensorme_ssl']) { header('Location: https://'.$host.$requri); } if ($scheme=='https' && $_COOKIE['dontcensorme_ssl']) { $scheme='http'; } $newhost = $host; if (strends($newhost, PROXY_SUFFIX)) $newhost=substr($host,0,-1*strlen(PROXY_SUFFIX)); if ('.'.$newhost==PROXY_SUFFIX) { header('Location: http://'.PROXY_HOME.PROXY_SUFFIX); exit; } $response = proxy($method,$scheme.'://'.$newhost.$requri); $redirect_url = trim($response['headers']['Location']); if ($redirect_url) { header('Location: '.rewrite($redirect_url)); } $type = $response['headers']['Content-Type']; $type = strtolower(substr($type,0,strpos($type,'/'))); if ($type=='text') $data = rewrite($response['data']); else $data = $response['data']; header('Content-Type: '.$response['headers']['Content-Type']); if ($response['headers']['Set-Cookie']) { $setcookie = $response['headers']['Set-Cookie']; if (is_array($setcookie)) { foreach ($setcookie as $cookie) { header('Set-Cookie: '.rewrite_cookie($cookie), false); } } else header('Set-Cookie: '.rewrite_cookie($response['headers']['Set-Cookie'])); } echo $data; //echo print_r($_SERVER); //echo print_r($response['headers']); ?>