[英]Apache rewrite while acting as a reverse proxy
我想使用apache重写将要转到第二个文件夹的所有内容重定向到站点的根目录或/。 但是,当我转到http://example.com/second/css/style.css时,它不会拉起http://example.com/css/style.css
我尝试了以下操作: Apache Reverse Proxy ReWrite,但是当我在conf文件中将ProxyHTMLEnable On放在On时,apache无法启动。
这就是我现在正在尝试的。 Apache确实启动了,但是我没有得到想要的重定向效果:
<VirtualHost *:80>
ServerName example.com
ServerAdmin admin@example.com
SetEnvIf Request_URI ".(jpg|jpeg|png|swf|css|gif|dat|ico|js)$" dontlog
#SetEnvIf Request_URI "/cron/" dontlog
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" varnishcombined
RewriteEngine On
RewriteRule ^second/(.*)$ /$1 [R=301,NC,L]
# ProxyRequests Off
# <Proxy *>
# Order deny,allow
# Allow from all
# </Proxy>
ProxyPass / http://127.0.0.1:8080/second/
ProxyPassReverse / http://127.0.0.1:8080/second/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
请尝试在conf文件中使用以下设置,因为我可以成功使用0.0.0.0。
ProxyPreserveHost On
ProxyPass / http://0.0.0.0:8080/second/
ProxyPassReverse / http://0.0.0.0:8080/second/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.