Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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 使用mod_rewrite将请求重定向到另一个域_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache 使用mod_rewrite将请求重定向到另一个域

Apache 使用mod_rewrite将请求重定向到另一个域,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,在Apache中是否可以将请求从我的域:www.example.com/index.html重定向到另一个域http://www.other-domain.com/page/info好像我直接访问了那个页面 所以用户不应该;我什么也没注意到。他应该简单地认为自己正在访问www.example.com,而apache则提供http://www.other-domain.com/page/info 这是因为另一个域是新服务器,用户也应该能够访问旧的URL。注意,我不想执行301重定向 我知道这可以通

在Apache中是否可以将请求从我的域:
www.example.com/index.html
重定向到另一个域
http://www.other-domain.com/page/info
好像我直接访问了那个页面

所以用户不应该;我什么也没注意到。他应该简单地认为自己正在访问
www.example.com
,而apache则提供
http://www.other-domain.com/page/info

这是因为另一个域是新服务器,用户也应该能够访问旧的URL。注意,我不想执行301重定向

我知道这可以通过
VirtualHost
实现,但我的网络主机不允许我使用它。我可以使用
mod_rewrite
,所以我希望我可以用它做同样的技巧

有人知道这是否可能,如果有,怎么做吗

RewriteEngine on
RewriteRule ^/index.html$  http://www.other-domain.com/page/info [PT]

实现这一点的唯一方法是在
www.example.com
上启用
mod_proxy
。启用
mod\u proxy
mod\u rewrute
后,将此规则放入
www.example.com
DocumentRoot/.htaccess

RewriteEngine On

RewriteRule ^/?(index\.html)?$ http://www.other-domain.com/page/info [L,P]