yii index.php隐藏的设置方法

yii index.php隐藏的设置方法: 首先开启apache的rewrite模块;然后去掉rewrite前的“#”符号;接着建立“.htaccess”文件;最后修改yii的配置文件“mail.php”即可。

yii index.php隐藏的设置方法

yii 隐藏index.php

    首先,开启apache的rewrite模块

    去掉rewrite前的#,如下所示

    LoadModule rewrite_module modules/mod_rewrite.so

 

立即学习PHP免费学习笔记(深入)”;

    接着,在yii的index.php同级目录建立.htaccess文件,内容如下

    <ifmodule>        Options +FollowSymLinks      IndexIgnore */*      RewriteEngine on       # if a Directory or a file exists, use it directly      RewriteCond %{REQUEST_FILENAME} !-f      RewriteCond %{REQUEST_FILENAME} !-d       # otherwise forward it to index.php      RewriteRule . index.php       </ifmodule>

 

立即学习PHP免费学习笔记(深入)”;

    最后,在yii的配置文件mail.php 中添加

      'urlManager'=&gt;array(        'urlFormat'=&gt;'path',        'showScriptName'=&gt;false,        'rules'=&gt;array(       '<controller:>/<id:>'=&gt;'<controller>/view',       '<controller:>/<action:>/<id:>'=&gt;'<controller>/<action>',       '<controller:>/<action:>'=&gt;'<controller>/<action>',      ),   ),</action></controller></action:></controller:></action></controller></id:></action:></controller:></controller></id:></controller:>

  

   这样就隐藏了index.php

推荐学习:《yii教程

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享