1

I have problem to connect to some webs on prod. When I try visit addres on local http://localhost:1337/zespol_noico/web/app_dev.php/formularz/kontakt it works,

http://localhost:1337/zespol_noico/web/formularz/kontakt works.

On server: http://dreamwebstudio.pl/works/zespol/web/app_dev.php/formularz/kontakt works but prod website http://dreamwebstudio.pl/works/zespol/web/formularz/intro not works. 404 Not Found. The request /works/zespol/web/formularz/intro was not found on this server. I have no idea why. I cleared prod cache if someone ask. I'd like to mentioned that mainpage http://dreamwebstudio.pl/works/zespol/web/ works fine. In default controller my annotation:

/**
 * @Route("/formularz/muzyka", name="formularz_muzyka")
 * @Template()
 */
public function muzykaAction(Request $Request){
    $Repo = $this->getDoctrine()->getRepository('MyFrontendBundle:Muzyka');
    $Register = $Repo->find("1");

    $form = $this->createForm(new MuzykaEditType(), $Register);
    $form->handleRequest($Request);
    $Muzyka = new MuzykaEditType();

    if ($Request->getMethod() == 'POST') {
        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($Register);
            $em->flush();
        }
    }
    return array(
        'form' => $form->createView(),
    );
}
Tomasz
  • 1,368
  • 3
  • 17
  • 31
  • Maybe the server does not have mod_rewrite enabled? – tlenss Apr 04 '15 at 11:50
  • In `.htaccess `is `RewriteEngine on`. I noticed that `http://dreamwebstudio.pl/works/zespol/web/app.php/formularz/intro` works too so the problem is with `app.php/app_dev.php` in address – Tomasz Apr 04 '15 at 11:57
  • It might be something else completly. But having `RewriteEngine on` in your .htaccess does not meen it's on. Make sure the module is loaded by your webserver. – tlenss Apr 04 '15 at 12:08

1 Answers1

0

I have found solution on symfony2 rewrite rules .htaccess app.php Problem for me was that I put code to .htaccess on main directory instead of in ../web/.htaccess

<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]
</IfModule>
Community
  • 1
  • 1
Tomasz
  • 1,368
  • 3
  • 17
  • 31