Symfony的2:如何删除" /网络/"从文件夹中的URL共享托管? [英] Symfony 2: How to remove the "/web/" folder from the url in a shared hosting?

查看:238
本文介绍了Symfony的2:如何删除" /网络/"从文件夹中的URL共享托管?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种方式,从应用程序的URL删除/网络/文件夹,在共享的环境中,这是我无法改变的DocumentRoot或创建一个虚拟主机。

I've been searching for a way to remove the "/web/" folder from an application URL in a shared environment, in which I cannot change the DocumentRoot or create a VirtualHost.

我发现基于mod_rewrite的一些解决方案,但它们都适用于Symfony的1.x中,或者他们只是不工作(我很新反正mod_rewrite的,所以它可能是我的错)。

I found some solutions based on mod_rewrite, but all of them apply to Symfony 1.x, or they just don't work (I'm very new to mod_rewrite anyway, so it may be my fault).

有没有办法与Symfony的2做到这一点?

Is there a way to do this with Symfony 2?

推荐答案

您必须设置Web服务器的文档根目录指向您的网络目录。如果你不能自定义文档根只需将网络目录下的内容直接放入文档根目录并移动上述所有其他工作人员一个级别。例如:

You have to set web server's document root pointing to your "Web" directory. If you can't customize document root just move content of your "web" directory directly into document root and move all other staff one level above. For example:

/home/username/www/html <---- this is the place where you put all things from "web"
/home/username/www/src  <---- and all other things one level above
/home/username/www/app
/home/username/www/vendor
...

这篇关于Symfony的2:如何删除&QUOT; /网络/&QUOT;从文件夹中的URL共享托管?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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