Home > PHP Framework > YII > body text

Hidden setting method of yii index.php

藏色散人
Release: 2020-07-04 10:18:11
Original
3273 people have browsed it

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
Copy after login

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>
Copy after login

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;,
     ),
  ),
Copy after login

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!

Related labels:
yii
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template