Yii hides the index. php file step by zccst1. modify Apache configuration httpd. conf & nbsp; (1) enable the mod_rewrite module of apache to remove the "#" symbol before LoadModulerewrite_modulemodulesmod_rewrite.so & nbsp; & nbsp Yii hide index. php file steps
Author: zccst
1. modify httpd. conf in Apache configuration
(1) enable the mod_rewrite module of apache to remove the "#" symbol before LoadModule rewrite_module modules/mod_rewrite.so.
(2) ensure "AllowOverride All"
Annotation: for wamp, the second AllowOverride All is enabled.
AllowOverride appears three times in the Apache configuration file, but only one place requires All, and the other two places are None.
(3) restart Apache
2. add the code to/protected/config/main. php in the project:
'Components' => array (... 'urlmanager' => array ('urlformat' => 'path', 'showscriptname' => false, // be sure not to enclose 'urlsuffix '=> '.html' in quotation marks for 'false ', // add the suffix ".html" to the train, and overlay the 'rules' => array ('sites '=> 'site/Index ',),),...),
3. add the file ". htaccess" in the same directory as the index. php file. the content is as follows:
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
Note: This section is also available in the yii Official Guide:
See: http://www.yiiframework.com/doc/guide/1.1/zh_cn/topics.url
In this way, you can hide the index. php entry file.