Home  >  Article  >  PHP Framework  >  Hidden setting method of yii index.php

Hidden setting method of yii index.php

藏色散人
藏色散人Original
2020-07-04 10:18:113265browse

Yii index.php hidden setting method: First enable the rewrite module of apache; then remove the "#" symbol before rewrite; then create the ".htaccess" file; finally modify the yii configuration file "mail.php "That's it.

Hidden setting method of yii index.php

yii Hide index.php

First, open the rewrite module of apache

Remove the # before rewrite, as shown below

    LoadModule rewrite_module modules/mod_rewrite.so

Next, create an .htaccess file in the same directory as index.php in yii, with the following content

    <IfModule mod_rewrite.c>   
    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>

Finally, add

      &#39;urlManager&#39;=>array(
       &#39;urlFormat&#39;=>&#39;path&#39;,
       &#39;showScriptName&#39;=>false,
       &#39;rules&#39;=>array(
      &#39;<controller:\w+>/<id:\d+>&#39;=>&#39;<controller>/view&#39;,
      &#39;<controller:\w+>/<action:\w+>/<id:\d+>&#39;=>&#39;<controller>/<action>&#39;,
      &#39;<controller:\w+>/<action:\w+>&#39;=>&#39;<controller>/<action>&#39;,
     ),
  ),

to the yii configuration file mail.php. This will hide the index.php

Recommended study: "yii Tutorial

The above is the detailed content of Hidden setting method of yii index.php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn