当我尝试通过此配置访问127.0.0.1/projectName/compte
或127.0.0.1/projectName/public/compte
或127.0.0.1/compte
时:
'compte' => array(
'type' => 'segment',
'options' => array(
'route' => '/compte[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Application\Controller\Compte',
'action' => 'index',
),
),
),
我收到404 Not Found错误。但是,当我尝试访问127.0.0.1/projectName/public
时,它适用于另一个页面。
请问有什么不对?
有什么好主意吗?
非常感谢!
答案 0 :(得分:0)
如果127.0.0.1/projectName/public/index.php/compte
有效,则mod_rewrite
问题。
请使用sudo a2enmod rewrite
和
使用sudo service apache2 restart
让我们知道结果。
答案 1 :(得分:0)
如果您将IIS与URL重写模块模块一起使用,请导入以下行:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [NC,L]
类似:Zend Framework 2 Htaccess和Zend Framework 2 .htaccess mamp pro。
查看更多(fr):FR - User-guide