Laravel如何镜像同一服务器上托管的另一个站点? [英] How could Laravel mirror another site hosted on the same server?

查看:89
本文介绍了Laravel如何镜像同一服务器上托管的另一个站点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在example.com上有一个Laravel网站,在blog.example.com上有一个WordPress网站.

I have a Laravel site at example.com and a WordPress site at blog.example.com.

除我希望使example.com的根目录(索引页面)显示(但不重定向至)blog.example.com的根目录之外,一切都很好.

Everything works well except that I'd love to have the root (index page) of example.com show (but not redirect to) the root of blog.example.com.

Laravel网站的主页如何在不进行重定向或浏览器URL更改的情况下镜像我博客的主页?

How can the homepage of my Laravel site mirror the homepage of my blog without there being a redirect or the browser's URL changing?

Route::get('/', function () {
    return redirect('https://blog.example.com');
});

Laravel是否可以通过某种方式代理博客主页?

Is there some way that Laravel could proxy the blog homepage?

由于两个站点都托管在同一台Cloudways服务器上(只是在不同的文件夹中),也许我可以使用某种别名?

Since both sites are hosted on the same Cloudways server (just in different folders), maybe I could use an alias of some kind?

P.S.服务器使用 Apache .

P.S. The server uses Apache.

推荐答案

我现在尝试使用以下内容(并且只需要弄清楚如何处理字体等的CORS错误):

I'm now trying to use the following (and just need to figure out how to handle the CORS errors for fonts, etc.):

Route::get('/', function () {
    return Response::make(file_get_contents(config('app.blog_url'))); 
});

这篇关于Laravel如何镜像同一服务器上托管的另一个站点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆