Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
设置Apache虚拟主机和ProxyPass_Apache_Wamp_Reverse Proxy_Mod Proxy - Fatal编程技术网

设置Apache虚拟主机和ProxyPass

设置Apache虚拟主机和ProxyPass,apache,wamp,reverse-proxy,mod-proxy,Apache,Wamp,Reverse Proxy,Mod Proxy,我正在尝试在我的WAMPSERVER 2.0i安装上设置虚拟主机。目前看来: http://domain/main http://domain/sub1 http://domain/sub2 我需要设置它,以便1)访问将重定向到,但2)并保持工作状态 当我像这样使用ReverseProxy时 <VirtualHost *:80> DocumentRoot "D:/WAMP/www" ServerName domain ProxyPass / http://

我正在尝试在我的WAMPSERVER 2.0i安装上设置虚拟主机。目前看来:

http://domain/main
http://domain/sub1
http://domain/sub2
我需要设置它,以便1)访问将重定向到,但2)并保持工作状态

当我像这样使用ReverseProxy时

<VirtualHost *:80>
    DocumentRoot "D:/WAMP/www"
    ServerName domain

    ProxyPass / http://domain/main/
    ProxyPassReverse / http://domain/main/

    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
</VirtualHost>
但是没有任何运气


有人能给我一些建议吗?谢谢

听起来您可能需要为sub1和sub2指定别名(以及位置/目录)指令


更一般地说,因为您似乎从同一个域运行所有内容,所以您应该使用mod_rewrite,而不是proxy。

以一种更简单的方式解决。因为我不关心用户访问时可以看到的地址行,所以我只使用了一个简单的
重定向匹配

RedirectMatch ^/$ /main

是的,你是对的。代理不是最好的主意。不知道为什么我从一开始就坚持。。。
RedirectMatch ^/$ /main