php各个框架的路由配置总结

一、Yii框架的路由配置
首先,取消index.php
这两种方法都是在自动添加index.php

方法一:使用.htaccess
添加.htaccess文件 与index.php同级

RewriteEngine on
# if a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward the request to index.php
RewriteRule . index.php

方法二:vhost


    ServerName public.oa.com
    DocumentRoot "D:\phpStudy\PHPTutorial\WWW\OA\frontend\web"
    
      # use mod_rewrite for pretty URL support
      RewriteEngine on
      # If a directory or a file exists, use the request directly
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      # Otherwise forward the request to index.php
      RewriteRule . index.php
      # use index.php as index file
      DirectoryIndex index.php
     

你可能感兴趣的:(框架,路由,Yii,Lavaral,Thinphp,Yaf,Zend,framewor)