我有3个symfony2应用,2个工作正常,但第三个只适用于默认页面。其余路由引发404错误。环境是:Ubunto 12.04 VirtualBox,apache 2,php 5.3.10,Mongobd。
这是de VHost内容:
<VirtualHost *:80>
DocumentRoot /home/adminuser/webs/servergrove/web
ServerName servergrove.local
ErrorLog /var/log/apache2/servergrove-error.log
CustomLog /var/log/apache2/servergrove-access.log combined
<Directory /home/adminuser/webs/servergrove/web>
AllowOverride All
</Directory>
</VirtualHost>
这是routing.yml:
homepage:
pattern: /
defaults: { _controller: SGLiveChatBundle:Default:index }
sglc_chat_homepage:
pattern: /sglivechat
defaults: { _controller: SGLiveChatBundle:Chat:index }
sglc_chat_invite:
pattern: /sglivechat/{sessId}/invite
defaults: { _controller: SGLiveChatBundle:Chat:invite }
......等等。
以下网址正常:http://servergrove.local/
以下(和任何其他)不会:http://servergrove.local/sglivechat
*Not Found
The requested URL /sglivechat was not found on this server.
Apache/2.2.22 (Ubuntu) Server at servergrove.local Port 80*
我对symfony的经验很少。我认为与重写引擎有关,但其他两个项目工作正常。
我在命令行上有这样的东西:
adminuser @ adminuser-VirtualBox-073n:〜/ webs / servergrove $ php app / console router:debug
[router] Current routes
Name Method Pattern
homepage ANY /
sglc_admin_index GET /admin/sglivechat
prueba ANY /prueba
adminuser @ adminuser-VirtualBox-073n:〜/ webs / servergrove $ php app / console router:dump-apache
RewriteCond %{PATH_INFO} ^/$
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:homepage,E=_ROUTING__controller:ServerGrove\SGLiveChatBundle\Controller\DefaultController::indexAction]
RewriteCond %{REQUEST_METHOD} ^(get) [NC]
RewriteCond %{PATH_INFO} ^/admin/sglivechat$
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:sglc_admin_index,E=_ROUTING__controller:ServerGrove\SGLiveChatBundle\Controller\AdminController::indexAction]
RewriteCond %{PATH_INFO} ^/prueba$
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:prueba,E=_ROUTING__controller:ServerGrove\SGLiveChatBundle\Controller\DefaultController::pruebaAction]
任何可能出错的想法?
答案 0 :(得分:0)
你说app_dev.php的路线运行良好;所以问题可以修复下一步: