zend framework 2.06 配置伪静态

阅读更多
.htaccess
内容如下:

RewriteEngine on                     
      RewriteRule   ^default_([-a-zA-Z0-9]+)\.html$   /default/$1   [L]
      RewriteRule   ^([-a-zA-Z0-9]+)_([-a-zA-Z0-9]+)\.html$   /default/$1   [L]
      RewriteRule   ^default_([-a-zA-Z0-9]+)_([-a-zA-Z0-9]+)\.html$   /default/$1/$2   [L]
      RewriteRule   ^default_([-a-zA-Z0-9]+)_([-a-zA-Z0-9]+)_([-a-zA-Z0-9]+)_([-a-zA-Z0-9]+)\.html$ /default/$1/$2/$3/$4 [L]
      RewriteRule !\.(js|ico|gif|bmp|jpg|png|css|xml|htm|txt|csv|swf|json)$ index.php [NC]

在文件加上这个还是不够啊
chdir(dirname(__DIR__));
if(!empty($_SERVER["REDIRECT_URL"]))$_SERVER["REQUEST_URI"]=$_SERVER["REDIRECT_URL"];//让zf 支持伪静态
include 'library/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
            'Zend\Loader\StandardAutoloader' => array(
                'autoregister_zf' => true
            )
));

Zend\Mvc\Application::init(require 'config/application.config.php')->run();
在index.php中添加一句话

你可能感兴趣的:(zend,framework,2)