We have shared a lot of knowledge about the Yii framework before, and also specially produced a Yii framework topic for everyone to learn. In this article, we will give an example of how Yii hides index.php in the URL. Share it with everyone for your reference, the details are as follows:
1. Modify the main.php under config/:
'urlManager'=>array(
' urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'
'
'
),
),
##2. Modify the content of the .htaccess file in the root directory of the website as follows:
# if a directory or a file exists, use it directlyRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d# otherwise forward it to index.phpRewriteRule . index.phpThe above content is how Yii hides index.php in the URL. I hope it can help everyone. Related recommendations:
Yii framework framework module development
How to load Yii’s own verification code function
Summary of database query operations of PHP Yii framework
The above is the detailed content of How to hide index.php in URL in Yii. For more information, please follow other related articles on the PHP Chinese website!