Symfony2的共享主机 [英] symfony2 on shared hosting

查看:242
本文介绍了Symfony2的共享主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在这方面的工作相当长一段时间都没有用。我已经得到了symfony中安装了一个共享的网络主机在那里我有零访问的DocumentRoot改到web /文件夹,这样是不是选择我......

I've been working on this for quite a while to no avail.. I've got symfony installed on a shared web-host where I have zero access to change the DocumentRoot to the web/ folder so that is not an option to me...

我已经写了我的htaccess

I've written my htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^$ web/app.php [QSA]
RewriteRule ^(.*)$ web/app.php/$1 [QSA, L]

我也试图与的RewriteBase网/ 的RewriteBase /网络/ 无济于事。

通过这个,symfony的是工作。我可以登录,我能做到这一切......唯一的问题是,没有任何资产都显示... Chrome开发人员工具,是告诉我它找到一个404是对的,因为它不读/网页/文件夹中的DocumentRoot。

With this, symfony is working.. I can login, I can do all of that... Only problem is, none of the assets are displaying... Chrome Developer Tools, is telling me it's finding a 404 which is right because it's not reading the /web/ folder as the DocumentRoot..

那么,如何解决这个问题,而无需重新写入文件,或任何..我们有了一种方法用的.htaccess做只是...

So, how to fix this issue without re-writing files, or anything.. There's got to be a way to do this with .htaccess only...

推荐答案

一种方法是在被设定 assets_bas​​e_urls 应用程序/ config.yml 例如

One way would be setting assets_base_urls in app/config.yml e.g

framework:
    #..
    templating:      
        engines: ['twig']
        assets_base_urls: http://your.site.com/web/

这篇关于Symfony2的共享主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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