What is the best way to implement a blog on a website that uses the Symfony framework?

心已入冬 提交于 2019-12-23 04:51:45

问题


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?

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.


回答1:


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.

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>

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.




回答2:


Or you can just go with: symblog.co.uk if you are willing to go a little more into the code.



来源:https://stackoverflow.com/questions/14609767/what-is-the-best-way-to-implement-a-blog-on-a-website-that-uses-the-symfony-fram

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