Home > Article > PHP Framework > Hidden setting method of yii index.php
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.
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
'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'rules'=>array( '<controller:\w+>/<id:\d+>'=>'<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', ), ),
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!