Home > Article > PHP Framework > How to hide index.php in yii 1.0
How to hide index.php in yii1.0: first open the "httpd.conf" file; then open "mod_rewrite.so"; then change the "AllowOverride" of the corresponding directory to ALL; finally in index. Create a new .htaccess in the same directory as php.
The operating environment of this article: windows7 system, yii1.0 version, DELL G3 computer
YII 1.0 Hide single entry index.php Set routing and Pseudo-static
Hide index.php
Ensure that LoadModule in the apache configuration file httpd.conf
rewrite_module modules/mod_rewrite.so is turned on (remove #)
Change the AllowOverride of the corresponding directory to ALL
Create a new .htaccess in the root directory, that is, in the directory at the same level as index.php
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
Set the routing rules in main.php
// uncomment the following to enable URLs in path-format 'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName' =>false, 'rules'=>array( 'index.html'=>array('index'), 'article/<id:\d+>' => array('article/index','urlSuffix'=>'.html'), 'category/<id:\d+>/<page:\d+>' => array('category/index','urlSuffix'=>'.html'), 'category/<id:\d+>/1' => array('category/index','urlSuffix'=>'.html'), ), ),
Recommended: "yii tutorial"
The above is the detailed content of How to hide index.php in yii 1.0. For more information, please follow other related articles on the PHP Chinese website!