Symfony frontend routes returning 404 errors while backend works fine

I’m facing an issue with my Symfony installation and could really use your insights.

I have a Symfony application with two components: the frontend that utilizes Apostrophe CMS and the backend that includes modules from the Doctrine admin generator.

While everything functions smoothly in my local environment, once I move to production, all frontend pages following the homepage trigger 404 errors. Oddly, the backend component operates without any problems.

To give you context, here’s my current Apache virtual host setup:

<VirtualHost *:80>
 DocumentRoot "/var/www/myproject/web"
 DirectoryIndex index.php
 <Directory "/var/www/myproject/web">
   AllowOverride All
   Options Indexes FollowSymLinks MultiViews
   Allow from All
 </Directory>

 ErrorLog /var/log/apache2/error.log

 Alias /sf /var/www/myproject/lib/vendor/symfony/data/web/sf
 <Directory "/var/www/myproject/lib/vendor/symfony/data/web/sf">
   AllowOverride All
   Allow from All
 </Directory>
</VirtualHost>

Given that the backend works properly, I’m uncertain whether this issue stems from an Apache configuration misstep or if it’s related to something else entirely. Has anyone else experienced similar issues?

that’s strange - why would just frontend routes break while backend is fine? have you looked into if the frontend and backend are differntly set up for routing? perhaps the frontend has some URL rewriting rules that aren’t quite working in production?

check your .htaccess file in the web dir - sounds like mod_rewrite ain’t enabled on your prod server or the rules ain’t workin right. also verify your apache conf has mod_rewrite loaded since apostrophe CMS probably needs clean URLs.

This sounds like a routing config issue with your Apostrophe CMS setup. Your backend’s working fine, so the problem’s probably how Apostrophe handles URL routing in production vs development. Check that your production environment has the same routing rules in your frontend config files. Also make sure your web server’s passing requests to the right frontend controllers. I’ve seen this before with CMS integrations - it’s usually missing or wrong rewrite rules for CMS-specific routing patterns, especially with the nested page structures that Apostrophe creates.