3

I'm new to Symfony2 and following the EnsJobeet tutorial. My VirtualHost config is as follows:

<VirtualHost *:80>
    ServerName jobeet.local
    DocumentRoot /var/www/ensjobeet/web/
    DirectoryIndex app.php
    ErrorLog /var/log/apache2/jobeet-error.log
    CustomLog /var/log/apache2/jobeet-access.log combined
    <Directory "/var/www/ensjobeet/web/">
        AllowOverride All
        Allow from All
    </Directory>
</VirtualHost>

When I make requests to jobeet.local/app_dev.php/job/ I get the jobs page, when I make requests to jobeet.local/app.php/job/ I get the jobs page. However requests to jobeet.local/job/ 404 with The requested URL /job/ was not found on this server.

I would have thought that requests jobeet.local/ and jobeet.local/app.php/ would have been equivalent but they don't appear to be so is there some other aspect of the environment configuration I have wrong?

3

Here an exemple for prod and dev vhosts

# Symfony 2 : monapp.dev
<virtualHost *:80>
  ServerName monapp.dev
  DocumentRoot /data/www/MonApp/web/

    <Directory "/data/www/MonApp/web">
      DirectoryIndex app_dev.php
      Options -Indexes FollowSymLinks SymLinksifOwnerMatch
      AllowOverride None
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ app_dev.php [QSA,L]
    </Directory>
</VirtualHost>

# Symfony 2 : monapp.prod
<VirtualHost *:80>
  ServerName monapp.prod
  DocumentRoot /data/www/MonApp/web/

    <Directory "/data/www/MonApp/web">
       DirectoryIndex app.php
       Options -Indexes FollowSymLinks SymLinksifOwnerMatch
       AllowOverride All
       Allow from All
    </Directory>
</VirtualHost>
| improve this answer | |
2

mod_rewrite was installed but not enabled. Silly me!!

| improve this answer | |
0

A combination of both files+ (@Bendihossan and @Emma) worked here...

<VirtualHost *:80>
    ServerName symfony2-7-9.dev
    DocumentRoot /var/www/symfony2-7-9/web/
    DirectoryIndex app.php
    ErrorLog ${APACHE_LOG_DIR}/symfony2-7-9-error.log
    CustomLog ${APACHE_LOG_DIR}/symfony2-7-9-custom.log combined
    <Directory "/var/www/symfony2-7-9/web/">
        Options -Indexes FollowSymLinks SymLinksifOwnerMatch
        AllowOverride None
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ app_dev.php [QSA,L]
    </Directory>
</VirtualHost>
| improve this answer | |
0

After Setting up Virtual Host, put below code into web/.htaccess file

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    #<IfModule mod_vhost_alias.c>
    #    RewriteBase /
    #</IfModule>

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app_dev.php [QSA,L]
</IfModule>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.