douang4294 2015-01-28 09:31
浏览 29

Symfony2从外部服务器上的url中删除web

I've been looking for the solution for a long time. There are a lot of such topics and I know it. But I still can't figure it out. How can I remove web from the symfony2 project url? I tried to do this with htaccess looking like this:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ web/$1 [L]

but it doesn't work. It gives me an error:

 No route found for "GET /web/"

I really can't change the root directory on this server as only thing I have is FTP permission. Anybody has any idea for this?

Edit: I also tried a trick to put all the files from web in root directory and the rest of the project higher. The problem is the highest directory I have access to is the root.

  • 写回答

1条回答 默认 最新

  • dqvj51875 2015-01-29 10:51
    关注

    You shall need to update your virtual host config file and set the DocumentRoot to point to the web folder.

    For example you may currently have it set as

    DocumentRoot /var/www/myproject/    
    

    but you need to update it to

    DocumentRoot /var/www/myproject/web    
    

    More information can be found within the Symfony2 cookbook here

    Also this shall stop anyone trying to access the config/parameters.yml

    评论

报告相同问题?

悬赏问题

  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站