Symfony routing exception for default routes

I have just installed Symfony2 and created my bundle. I removed the Acme demo bundle and tested my new route “/” which worked fine.

I then went to config.php and followed the link to _configurator and get the above route error. I also get the same error when trying to load _profiler.

Here is my route file:

asf_core_homepage:
    pattern:  /
    defaults: { _controller: ASFCoreBundle:Home:index }

And the Symfony routing_dev file:

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

_configurator:
    resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
    prefix:   /_configurator

_main:
    resource: routing.yml

Any ideas why this is happening?

Did the error message say anything besides just “routing exception”?

I could speculate that perhaps you need to use “path” instead of “pattern”. But if that’s not it, it would be easiest if you could publish a repo that reproduces the issue.

Sorry I forgot to include the full exception (Copy and pasted the post from stack overflow). The full exception is:

NotFoundHttpException: No route found for "GET nfigurator/" (from "http://dev.asimpleforum.com/forum/config.php")

Just a few things I have tried:

Removed all routes except _configurator (still wont work)
wrapped the route prefix in quotes (nope, nothing)

I have deleted the cache via console app/console cache:clear and removed the folder manually just incase.

This is from a fresh install of Symfony. Just to make sure I reinstalled Symfony from fresh (with the demo) and went to /hello/carl as per the docs. I get the same exception in this instance:

No route found for "GET o/carl"

I have pushed the entire code base for the fresh install example to https://github.com/cjmarkham/symfony-bug

On a further note, just incase there was something wrong with the downloaded version I have, I re-downloaded it and still come across the same exception. This hasn’t happened before as I clearly remember using these routes when I started learning Symfony. I am trying to convert an entire project over to Symfony. This error isn’t stopping me but I would rather know what went wrong now incase it causes troubles later on.

I have narrowed it down and it looks like it has nothing to do with symfony. I have it installed in a subfolder of root so I use htaccess to rewrite all requests from /forum to /forum/web

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

If I point the browser to /forum/app_dev.php it works fine. the error comes from /forum/app_dev.php/_configurator

But if I skip the rewrite rule and use /forum/web/app_dev.php/_configurator it works fine.

What stands out to me is that the first four characters from both URLs are missing. Since you’ve already been able to isolate the issue to your rewrite rules, you’ll probably need to post your entire htaccess for us to look at.

That is the entire htaccess apart from a www redirect at the top


RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\\.
RewriteCond %{HTTP_HOST} !^dev\\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

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