For learning purposes I am building a toy site with symfony.
When accessing the site in dev-mode via app_dev.php everything works fine.
Also in production mode everything works except for one uri "/music". Here I encounter a strange 404 error, since a redirect to "/music/" occurs.
After some research I tried several things as described below. But I always get the same error. Maybe anyone can give me a hint how to solve this.
Here is the log entry, note that it searches for a route matching "/music/", not "/music" as it was send to the server
[2013-10-23 21:01:37] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /music/"" at /var/www/symfony/runamusic.de/app/cache/prod/classes.php line 1883 {"exception":"[object] (Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for \"GET /music/\" at /var/www/symfony/runamusic.de/app/cache/prod/classes.php:1883, Symfony\Component\Routing\Exception\ResourceNotFoundException: at /var/www/symfony/runamusic.de/app/cache/prod/appProdUrlMatcher.php:197)"} []
I checked permissions to app/cache/prod, they seem to be o.k.
I cleared the chache by both removing "app/cache/prod" manually and running php app/console cache:clear --env=prod --no-debug
Also running php app/console router:match /music
gives the correct route
ludviki@ludviki-MacBook:/var/www/symfony/runamusic.de$ php app/console router:match /music
Route "runamusic_music_album_index" matches
[router] Route "runamusic_music_album_index"
Name runamusic_music_album_index
Path /music
Host ANY
Scheme ANY
Method ANY
Class Symfony\Component\Routing\Route
Defaults _controller: Runamusic\MusicBundle\Controller\AlbumController::indexAction
Requirements NO CUSTOM
Options compiler_class: Symfony\Component\Routing\RouteCompiler
Path-Regex #^/music$#s
When importing routes in "app/config/routing.yml" no prefixes are added (I read about redirect issues with prefixes)
...
runamusic_home:
resource: "@RunamusicHomeBundle/Resources/config/routing.yml"
prefix: /
runamusic_music:
resource: "@RunamusicMusicBundle/Resources/config/routing.yml"
prefix: /
runamusic_show:
resource: "@RunamusicShowBundle/Resources/config/routing.yml"
prefix: /
...
Here is the route definition in "Bundle/.../config/routing.yml"
runamusic_music_album_index:
pattern: /music
defaults: { _controller: RunamusicMusicBundle:Album:index }
runamusic_music_album_show:
pattern: /music/album/{title}
defaults: { _controller: RunamusicMusicBundle:Album:show }
...
Renaming the pattern from /music to for example /musica works, no redirect here.
Redefining a pattern in another bundle to /music yields the same unwanted redirect to /music/.
Also any nonexisting Route I tried is redirected (no redirect from /Music to /Music/)
I am aware that a possible solution was to change the pattern for this route. But I would like to understand what is going wrong here to avoid this in the future.
Maybe an rewrite error in .htaccess?
Thanks for your help.
Edit 3: removed previous adds