JonBlog
Thoughts on website ideas, PHP and other tech topics, plus going car-free
Symfony routing with named controller returns Apache 404
Categories: PHP, Symfony

I was recently in the process of moving some sites to a new server, and found that a particular format of URI was not working on the new server:

http://myserver/frontend_dev.php/criteria/analyse

Normally in a symfony application, the default .htaccess file ensures that anything after the controller (i.e. frontend_dev.php) is simply passed to that controller, rather than interpreting it as a directory structure. However, for some reason this wasn’t working, and was just returning a standard 404 from the web server. The primary culprit for this error is the mod_rewrite extension that either isn’t loaded or enabled, but in my case it was totally fine.

In fact, it turned out to be the config on the new server. PHP was enabled by virtue of having installed libapache2-mod-php5filter, rather than libapache2-mod-php5. I uninstalled the former, installed the latter, and restarted Apache – and bingo, it started working. Hope this is of use to someone!

Leave a Reply