I'm trying to get this htaccess code to work:
<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>
mod_rewrite is enabled, but I've been told that mod_proxy is not enabled/available on Litespeed.
Is there a PHP workaround to running this?
Thanks
I was just trying the same thing on LiteSpeed and found your post. The only way I could achieve the proxying was via a simple one-line PHP script.
<?= file_get_contents('http://example.com/');
So to do what you're doing, it would be something more like this...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^fld/(.*) proxy.php?fld=$1 [QSA,last]
RewriteRule ^?$ proxy.php [QSA,last]
</IfModule>
And in proxy.php:
<?= file_get_contents(
'http://example.com/'
. '?fld=' . $_GET['fld']
. '&remoteaddr=' . $_SERVER['REMOTE_ADDR']
);
I hope that makes sense. If your hosting provider happens to block remote URLs in this manner, you might need to use curl which is a bit more code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With