问题
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