在使用Symfony框架的网站上实施博客的最佳方法是什么? [英] What is the best way to implement a blog on a website that uses the Symfony framework?

查看:52
本文介绍了在使用Symfony框架的网站上实施博客的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的公司网站是使用Symfony框架构建的.我们想在一个子目录中添加一个博客(因此该网站将是www.ourwebsite.com/blog).最简单的方法是什么?

Our company website was built using the Symfony framework. We want to add a blog to it in a subdirectory (so the website will be www.ourwebsite.com/blog). What is the easiest way to do this?

理想情况下,我想使用WordPress,因为这是我最有经验的方法,但是不能将整个站点切换到WordPress.一种选择是为博客(blog.ourwebsite.com)创建一个子域,但是我们在SEO上投入了大量资金,并且我们的网站已经拥有不错的排名.我们想使用博客来进一步提高网站的排名,并且我认为将其放在子域中会使我们完成有限的研究工作而拖慢了实现目标的速度.

Ideally, I would like to use WordPress as it is what I am most experienced in, but switching the entire site over to WordPress is not an option. One option is to create a subdomain for the blog (blog.ourwebsite.com) but we are investing a large amount of money into SEO and our website already has decent rankings. We would like to use a blog to further increase the rankings of our website, and I feel that having it in a subdomain would slow us down from reaching our goals based on the limited amount of research I've done.

推荐答案

我将在网络服务器级别解决此问题.假设Symfony应用程序位于/var/www/example.com,而Wordpress博客位于/var/www/blog.example.com.

I would solve this at the webserver level. Suppose the Symfony app lives at /var/www/example.com and the Wordpress blog at /var/www/blog.example.com.

对于Apache,应该执行以下操作:

For Apache, something like this should do:

<VirtualHost example.com:80>
    DocumentRoot /var/www/example.com
    ServerName example.com

    <Directory /var/www/example.com>
        # Your Symfony config here
    </Directory>

    Alias /blog /var/www/blog.example.com

    <Directory /var/www/blog.example.com>
        # Your Wordpress config here
    </Directory>
</VirtualHost>

有关详细信息,请参见别名指令.如果您有这个主意,那么如果不使用Apache,将其适应其他Web服务器(例如Nginx)应该是很直接的.

See Alias directive for details. If you get the idea, it should be straightfoward to adapt this to other webservers, such as Nginx, if you're not using Apache.

这篇关于在使用Symfony框架的网站上实施博客的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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