Bonjour les gars j'ai un problème avec ZF2 avec htaccess. Je crée VHOST et tout fonctionne bien. quand j'appelleZend Framework 2 Htaccess
my-vhost.localhost travailler tout bon, mais quand j'ajouter un segment uri comme index.php ou/1234 Je reçois 404.
Je .htaccess modifier en dir publique et mettre
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [NC,L]
Bur encore j'ai 404. Une idée comment je peux je ralentir cela?
Mon plein .htaccess est:
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]
VHOST
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot /var/www/html/zf2-tutorial/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/html/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Qui pense problème est routage vérifier mon mod d'itinéraire.
<?php
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album[/][:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);
Vous avez une idée sur les routages ZF2? –
Ce n'est pas le routage c'est HTACCESS LIRE ALBUM TUTORIEL – Ivan
S'il vous plaît envoyer votre fichier vhost aussi si vous le pouvez. Cela peut être quelque chose comme AllowOverride est défini sur none (dans ce cas le .htaccess n'est jamais exécuté) ou vous pointez sur le mauvais dossier? – Adrian