0

I have 3 symfony2 apps, 2 work fine, but the third just works for the default page. The rest of the routes throw a 404 error. Environment is: Ubunto 12.04 VirtualBox, apache 2, php 5.3.10, Mongobd.

This is de VHost content:

<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>

This is the 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 }

... and so on.

The following url works fine: http://servergrove.local/

The following (and any other) doesn't: 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*

I have very little experience with symfony. I'd think is related with rewrite engine, but the other two projects works ok.

I've got something like this on the command line:

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]

Any idea of what can be wrong?

4

1 回答 1

1

You said that the route works fine with the app_dev.php; so the problem could be fixed doing the next:

  • Verify if you have the .htaccess file in the web directory.
  • Ensure your apache server have the mod_rewrite module enabled.
  • Erase the cache in your prod environment.
于 2013-10-02T17:23:32.233 回答