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 如何重定向到另一个域,但不使用.htaccess显示URL重定向?_Apache_.htaccess_Mod Proxy - Fatal编程技术网

Apache 如何重定向到另一个域,但不使用.htaccess显示URL重定向?

Apache 如何重定向到另一个域,但不使用.htaccess显示URL重定向?,apache,.htaccess,mod-proxy,Apache,.htaccess,Mod Proxy,我不确定.htaccess是否可以处理这个问题,我确实搜索了很多相关主题,但没有找到解决方案 我需要的是: 当我的用户访问我的网站时:www.mysite.com 实际上,他们是从www.otherplace.com/folder1/folder2/folder3/page.html中获取内容的 我希望用户的浏览器地址显示:www.mysite.com或www.mysite.com/page.html对我来说也可以,但不显示网站的任何内容:www.otherplace.com…. html只是一

我不确定.htaccess是否可以处理这个问题,我确实搜索了很多相关主题,但没有找到解决方案

我需要的是:

当我的用户访问我的网站时:www.mysite.com

实际上,他们是从www.otherplace.com/folder1/folder2/folder3/page.html中获取内容的

我希望用户的浏览器地址显示:www.mysite.comwww.mysite.com/page.html对我来说也可以,但不显示网站的任何内容:www.otherplace.com….

html只是一个页面,tiddlywiki,:)


谢谢。:)

如果您使用的是apache,这可以通过代理完成。 打开
/etc/apache2/mods available/proxy.conf
并添加用户的定义

<IfModule mod_proxy.c>
        ProxyRequests Off

        <Proxy *>
                AddDefaultCharset off
                Order Allow,Deny
                Allow from all
        </Proxy>

    ProxyPass / http://www.otherplace.com/folder1/folder2/folder3/page.html
    ProxyPassReverse / http://www.otherplace.com/folder1/folder2/folder3/page.html

</IfModule>
并且url是,而不是

请记住重新启动apache
sudo服务apache2 restart
或其他等效程序


重写是另一种选择,但IMO代理更容易设置,尽管它没有那么强大。

恐怕您必须使用代理更改url而不重定向。请告诉我如何执行“代理”操作?我是个新手,如果你能详细介绍一下,我将不胜感激。:)谢谢。请看以下答案:嗨,我正在使用bluehost的共享主机服务,这在我的主机上能正常工作吗?我将尝试你提到的一切,直到我红色的“重新启动apache”,我想我必须在我真正使用你的方法之前确认,因为我认为我没有任何权限来做重新启动的事情,:)好主意。您可以使用快速设置带有apache的服务器。如果其他人编辑了apache配置,可能会出现问题,您最好备份所有内容以防万一。在共享主机中重新启动服务器也是个坏主意,但有时我们真的必须改变一些东西。
ProxyPass         /jenkins  http://localhost:8080/jenkins
ProxyPassReverse  /jenkins  http://localhost:8080/jenkins