在Laravel应用程序中托管wordpress博客 [英] Hosting a wordpress blog in a Laravel application

查看:45
本文介绍了在Laravel应用程序中托管wordpress博客的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在一个实例上的一个自动缩放组中部署了一个Laravel应用程序,在一个实例中的blog.example.com上部署了一个wordpress博客.

I currently have a Laravel application deployed in a autoscaling group at www.example.com and a wordpress blog at blog.example.com on a single instance.

我被要求将博客移至example.com/blog.

我不想合并代码库,并且博客不需要位于自动缩放组中.

I don't want to merge the code bases and the blog does not need to be in the autoscaling group.

我试图使用重写规则将example.com/xxx重写为blog.example.com,而不会影响浏览器中的url,但是我只能使它重定向到地址栏中以blog.example.com/xxx结尾的URL.

I tried to use rewrite rules to rewrite example.com/xxx to blog.example.com without affecting the url in the browser but I can only get it to redirect ending up with blog.example.com/xxx in the address bar.

实现example.com/blog/xxx作为有效URL的同时让我可以在远离Laravel应用的地方托管Wordpress安装的最佳方法是什么?

What is the best way to achieve having example.com/blog/xxx as a valid url while allowing me to host the Wordpress installation far far far away from my Laravel app?

这是我尝试进行网址重写的尝试,

This was my attempt at url rewriting which didn't work

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?example.com$ [NC]
RewriteRule ^/blog(.*)?$ http://www.example.com/$1 [L,R]

非常感谢

推荐答案

尝试先使用此 Laravel规则:

Try to use this before Laravel rules:

RewriteRule ^blog - [L,NC]

这将使您可以将Wordpress与Laravel一起使用.

This will let you use Wordpress with Laravel.

此外,您可以尝试此解决方案.

这篇关于在Laravel应用程序中托管wordpress博客的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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