i have a question about PHP curl & .htaccess.
My index.php file:
<?php
if(!isset($_GET['q'])){
}
else {
$q=$_GET['q'];
}
$url = "http://81.83.192.124:8080/".@$q;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_REFERER, $url);
$result = curl_exec($ch);
curl_close($ch);
print $result;
?>
My .htaccess file:
RewriteEngine On
RewriteBase /
RewriteRule ^([abc][^/]+) index.php?q=$1
The intentions is, when i go to http://example.org/NL/
i go with the curl to:
http://81.83.192.124:8080/NL/
So far i am, 开发者_运维技巧but when i click on a link, i doesn't work further. Who can help me?
So your code is acting as a proxy of sorts for 81.83.192.124:8080? You'll run into a few issues. First, links with absolute paths would have to be rewritten. Second, you'll have to capture cookies in both directions if the underlying site requires them to work.
I think your issue is here...
RewriteRule ^([abc][^/]+) index.php?q=$1
should be more like this...
RewriteRule ^([abc][^/]+)/$ index.php?q=$1
see if that works for you
精彩评论