Symfony and Apostrophe CMS: Frontend 404 errors on production server

I’m having trouble with my Symfony setup. It has two apps: a frontend using Apostrophe CMS and a backend with Doctrine admin generator modules. Everything works fine locally, but on the production server, all frontend pages (except the homepage) return 404 errors. Strangely, the backend pages work without issues.

I’m not sure if it’s an Apache config problem, as the backend works. Here’s my current Apache config:

<VirtualHost *:80>
 DocumentRoot "/my-project/web"
  DirectoryIndex index.php
  <Directory "/my-project/web">
    AllowOverride All
    Options Indexes FollowSymLinks MultiViews
    Allow from All
  </Directory>

  ErrorLog /var/log/apache2/project-error.log

  Alias /assets /my-project/lib/vendor/symfony/data/web/assets
  <Directory "/my-project/lib/vendor/symfony/data/web/assets">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

Any ideas on what might be causing this issue or how to fix it? Thanks in advance for your help!

hmm, that’s a tricky one! have you checked your .htaccess file in the web directory? sometimes it can cause weird routing issues. also, are you sure apostrophe is configured correctly for production? maybe try clearing the cache and checking the symfony logs for any clues? what version of symfony are you using btw?

Have you considered the possibility of a misconfiguration in your Symfony routing for the production environment? It’s worth examining your config_prod.yml file to ensure all routes are correctly defined. Additionally, verify that your Apostrophe CMS settings are properly adjusted for the production server, particularly the baseUrl and other environment-specific configurations. Another aspect to investigate is the server’s mod_rewrite module. Ensure it’s enabled and functioning correctly, as it’s crucial for proper URL handling in Symfony applications. Lastly, review your production logs thoroughly for any specific error messages that might provide more insight into the 404 issues you’re encountering.

sounds frustrating! did u try checking ur symfony routing config? sometimes prod env can mess things up. also, make sure apostrophe’s url generation is set up right for live site. might be worth double-checking rewrite rules in apache too. good luck troubleshooting!