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

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

问题描述

我已经为此工作了很长时间但无济于事.给我的选择...

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 web/RewriteBase/web/ 尝试过,但无济于事.

I have also tried this with RewriteBase web/ and RewriteBase /web/ to no avail.

有了这个,symfony 正在工作..我可以登录,我可以做所有这些......唯一的问题是,没有任何资产显示...... Chrome 开发者工具告诉我它正在找到一个 404,它是正确,因为它没有将/web/文件夹读取为 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...

推荐答案

一种方法是在 app/config.yml 中设置 assets_base_urls 例如

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天全站免登陆