Php 在LiteSpeed上使用.htaccess的mod_代理
我正在尝试使此htaccess代码正常工作:Php 在LiteSpeed上使用.htaccess的mod_代理,php,apache,.htaccess,mod-proxy,litespeed,Php,Apache,.htaccess,Mod Proxy,Litespeed,我正在尝试使此htaccess代码正常工作: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^fld/(.*) http://example.com/fld/$1?proxy=http://example.com [P] RewriteRule ^/?$ http://example.com/fld/app/cobra/847?remoteaddr=%{REMOTE_ADDR}&proxy=http:/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^fld/(.*) http://example.com/fld/$1?proxy=http://example.com [P]
RewriteRule ^/?$ http://example.com/fld/app/cobra/847?remoteaddr=%{REMOTE_ADDR}&proxy=http://mydomain.com/customfolder [QSA,P]
</IfModule>
重新启动发动机
重写规则^fld/(*))http://example.com/fld/1美元?代理=http://example.com [P]
重写规则^/?$http://example.com/fld/app/cobra/847?remoteaddr=%{REMOTE_ADDR}&代理=http://mydomain.com/customfolder [QSA,P]
mod_rewrite已启用,但我被告知Litespeed上的mod_代理未启用/可用
是否有PHP解决方案来运行此功能
谢谢我刚刚在LiteSpeed上尝试了同样的方法,找到了你的帖子。实现代理的唯一方法是通过一个简单的一行PHP脚本
<?= file_get_contents('http://example.com/');
我希望这是有道理的。如果您的托管提供商碰巧以这种方式阻止远程URL,那么您可能需要使用curl,这是一个稍微多一些的代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^fld/(.*) proxy.php?fld=$1 [QSA,last]
RewriteRule ^?$ proxy.php [QSA,last]
</IfModule>
<?= file_get_contents(
'http://example.com/'
. '?fld=' . $_GET['fld']
. '&remoteaddr=' . $_SERVER['REMOTE_ADDR']
);