Home  >  Article  >  PHP Framework  >  How to hide index.php in yii 1.0

How to hide index.php in yii 1.0

藏色散人
藏色散人Original
2021-03-16 10:07:416269browse

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.

How to hide index.php in yii 1.0

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'),
                &#39;article/<id:\d+>&#39; => array(&#39;article/index&#39;,&#39;urlSuffix&#39;=>&#39;.html&#39;),
                &#39;category/<id:\d+>/<page:\d+>&#39; => array(&#39;category/index&#39;,&#39;urlSuffix&#39;=>&#39;.html&#39;),
                &#39;category/<id:\d+>/1&#39; => array(&#39;category/index&#39;,&#39;urlSuffix&#39;=>&#39;.html&#39;),
			),
		),

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!

Statement:
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