douzhenzu0247 2014-09-17 10:16
浏览 198
已采纳

将Symfony 2.5.3网站部署到生产服务器

I have been working on a website in development environment built on top of Symfony framework and now it is time to deploy it to live site, in development environment we run the command php app/console server:run to run the website but I am not sure what needs to be done to make the user see website contents on live server, after i uploaded the code to live server all I see is root directory structure of Symfony, I have gone through How to Deploy a Symfony Application and i am scratching my head as there is got to be more to it because after following the steps no difference was made and i still see directory structure.

I did notice that when I click on the web folder I see the website so I created the following .htaccess file which works but the URL looks like www.domain.com/web how can i just make it www.domain.com

<IfModule mod_rewrite.c>
RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ web/$1 [QSA,L]
</IfModule>

I will really appreciate if I can get some help here, if it helps I am trying to deploy on Linux based server using Apache.

SOLUTION Add the following in your .htaccess file and it will work as this is what solved my problem and please remember to clear your browser cache as well

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1 [L]
</IfModule>
  • 写回答

4条回答 默认 最新

  • doushun1870 2014-09-18 07:53
    关注

    After following all the How to deploy a Symfony App, in the root of your Symfony application create .htaccess file and add the following code in it, this is what solved my problem.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.domain.com$
    RewriteCond %{REQUEST_URI} !web/
    RewriteRule (.*) /web/$1 [L]
    </IfModule>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作