0

Im deploying a symfony2 app on production server.

Im working on the web/.htaccess file and I can not get it "redirect" to app.php.

My actual file is:

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

# Explicitly disable rewriting for front controllers
RewriteRule ^app_dev.php - [L]
RewriteRule ^app.php - [L]

RewriteCond %{REQUEST_FILENAME} !-f

# Change below before deploying to production
#RewriteRule ^(.*)$ /app.php [QSA,L]
RewriteRule ^(.*)$ /app_dev.php [QSA,L]

If I copy this file on production server (/web folder) it redirects to dev version. But if I change the comments of two last lines:

RewriteRule ^(.*)$ /app.php [QSA,L]
#RewriteRule ^(.*)$ /app_dev.php [QSA,L]

I got a 500 internal server error.

Could you help me? Thanks!

Based on: Greg Solution

Community
  • 1
  • 1
InsaurraldeAP
  • 682
  • 7
  • 16
  • What exactly is your issue? – Amit Verma Jan 27 '16 at 16:02
  • If I leave uncommented "RewriteRule...app_dev.php" it works (it runs on dev mode), If I do the same with "RewriteRule...app.php", it returns an internal server Error. – InsaurraldeAP Jan 27 '16 at 17:19
  • And what does it say in your error logs? – Mike Rockétt Jan 27 '16 at 17:46
  • Nothing is written on logs, not "error_log", nor "prod.log" :( – InsaurraldeAP Jan 27 '16 at 18:26
  • I could make it log now: PHP Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\InvalidArgumentException' with message 'There is no extension able to load the configuration for "web_profiler" (in ***/app/config/config_prod.yml). Looked for namespace "web_profiler", found "framework", "security", "twig", "monolog", "swiftmailer", "doctrine", "sensio_framework_extra"' in ***/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php:363 – InsaurraldeAP Jan 27 '16 at 18:45
  • Ready, I have the solution in this link and it worked! http://stackoverflow.com/a/9893121/495466 – InsaurraldeAP Jan 27 '16 at 18:55

0 Answers0