How could Laravel mirror another site hosted on the same server?

强颜欢笑 提交于 2019-12-24 10:58:52

问题


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:


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


来源:https://stackoverflow.com/questions/45197416/how-could-laravel-mirror-another-site-hosted-on-the-same-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!