有没有办法从 Symfony 应用程序中的 url 中删除“/web",而无需将“web"目录的内容移动到根目录? [英] Is there a way to remove '/web' from url in Symfony application without moving content of 'web' directory to root?

查看:33
本文介绍了有没有办法从 Symfony 应用程序中的 url 中删除“/web",而无需将“web"目录的内容移动到根目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Symfony 创建应用程序时遇到问题,即 url 中出现/web".我找到了一种通过将web"目录的内容移动到根目录来摆脱这种情况的方法.但我认为这不是一个好的开发实践,必须有其他方式.任何人都可以让我知道是否有其他方法可以做到这一点,就像我们使用 htaccess 从 url 中删除 app_dev.php 一样?

I am facing a problem while creating applications using Symfony which is the occurrence of '/web' in the url. I found a way to get rid of this by moving the content of 'web' directory to root directory. But I think that is not a good development practice and there must be some other way. Can anyone let me know if there is some other way of doing this some thing like we do for removing app_dev.php from url using htaccess ?

推荐答案

就我而言,我正在使用 wamp 服务器并摆脱/web",您需要在 httpd-vhosts.conf 中配置一个虚拟主机,如下所示:

In my case im working with wamp server and to get rid of "/web" you need to configure a virtual host in httpd-vhosts.conf like this :

<VirtualHost *:80>
    DocumentRoot C:\wamp\www\YourProjectFolder\web
    ServerName projectName.local
</VirtualHost>

我认为你应该在你的主机服务器上做同样的事情.

I think you shoold do the same in your host server.

这篇关于有没有办法从 Symfony 应用程序中的 url 中删除“/web",而无需将“web"目录的内容移动到根目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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