How could Laravel mirror another site hosted on th

2019-08-02 03:38发布

I have a Laravel site at example.com and a WordPress site at 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.

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');
});

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

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. The server uses Apache.

1条回答
叛逆
2楼-- · 2019-08-02 04:32

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'))); 
});
查看更多
登录 后发表回答