title: Zend Framework 2 Htaccess
body: <p>Hello guys i have problem in ZF2 with htaccess.</p>
  
  <p>I create vhost and all work good. when i call</p>
  
  <p><strong>my-vhost.localhost</strong> all work good but when i add some uri segment like /index.php or /1234
  I get 404. </p>
  
  <p>I edit .htaccess in public dir and put</p>
  
  <pre><code>RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^.*$ index.php [NC,L]
  </code></pre>
  
  <p>Bur again i have 404. Any idea how i can i slow this?</p>
  
  <p>My full .htaccess is :</p>
  
  <pre><code>RewriteEngine On
  
  # The following rule tells Apache that if the requested filename
  # exists, simply serve it.
  
  RewriteCond %{REQUEST_FILENAME} -s [OR]
  RewriteCond %{REQUEST_FILENAME} -l [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^.*$ - [NC,L]
  
  # The following rewrites all other queries to index.php. The 
  # condition ensures that if you are using Apache aliases to do
  # mass virtual hosting, the base path will be prepended to 
  # allow proper resolution of the index.php file; it will work
  # in non-aliased environments as well, providing a safe, one-size 
  # fits all solution.
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^.*$ index.php [NC,L]
  RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
  RewriteRule ^(.*) - [E=BASE:%1]
  RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
  </code></pre>
  
  <p>VHOST</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName zf2-tutorial.localhost
      DocumentRoot /var/www/html/zf2-tutorial/public
      SetEnv APPLICATION_ENV "development"
      &lt;Directory /var/www/html/zf2-tutorial/public&gt;
          DirectoryIndex index.php
          AllowOverride All
          Order allow,deny
          Allow from all
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Who think problem is routing check my route mod.</p>
  
  <pre><code>&lt;?php
  return array(
      'controllers' =&gt; array(
          'invokables' =&gt; array(
              'Album\Controller\Album' =&gt; 'Album\Controller\AlbumController',
          ),
      ),
  
      // The following section is new and should be added to your file
      'router' =&gt; array(
          'routes' =&gt; array(
              'album' =&gt; array(
                  'type'    =&gt; 'segment',
                  'options' =&gt; array(
                      'route'    =&gt; '/album[/][:action][/:id]',
                      'constraints' =&gt; array(
                          'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*',
                          'id'     =&gt; '[0-9]+',
                      ),
                      'defaults' =&gt; array(
                          'controller' =&gt; 'Album\Controller\Album',
                          'action'     =&gt; 'index',
                      ),
                  ),
              ),
          ),
      ),
  
      'view_manager' =&gt; array(
          'template_path_stack' =&gt; array(
              'album' =&gt; __DIR__ . '/../view',
          ),
      ),
  );
  </code></pre>