相关疑难解决方法(0)

如何在.htaccess中设置代理

Apache文档声明RewriteRule应该放在服务器配置中,但由于共享托管情况,它们可以放在htaccess中.我处于这种情况.

我正在尝试设置透明代理:

 RewriteEngine On
 RewriteCond %{REQUEST_URI} ^/foo [OR]
 RewriteCond %{REQUEST_URI} ^/bar
 RewriteRule ^(.*)$ http://example.com/$1 [P]
Run Code Online (Sandbox Code Playgroud)

这工作正常......除了重定向(如果/foo重定向到/bar).重定向返回到example.com,而不是我的服务器.

我理解该ProxyPassReverse指令将解决这个问题,但是当我添加它时,我得到一个"内部服务器错误"页面.htaccess

与Rewrite指令不同,它ProxyPassReverse不适用于htaccess.

如何在共享主机环境中设置透明代理,或者这是不可能的?

(这似乎是合理的,因为Rewrite已经获得了80%的路径,并且在一个htaccess中拥有透明代理不会干扰在另一个htaccess中使用它.)

apache .htaccess proxy transparentproxy

13
推荐指数
1
解决办法
3万
查看次数

标签 统计

.htaccess ×1

apache ×1

proxy ×1

transparentproxy ×1