首頁  >  文章  >  php框架  >  yii 1.0 index.php怎麼隱藏

yii 1.0 index.php怎麼隱藏

藏色散人
藏色散人原創
2021-03-16 10:07:416206瀏覽

yii1.0隱藏index.php的方法:先開啟「httpd.conf」檔案;然後開啟「mod_rewrite.so」;接著將相對應目錄的「AllowOverride」改為ALL;最後在index. php同級目錄下新建.htaccess。

yii 1.0 index.php怎麼隱藏

本文操作環境:windows7系統、yii1.0版,DELL G3電腦

YII 1.0 隱藏單入口index.php 設定路由與偽靜態

隱藏index.php

保證apache設定檔httpd.conf裡的LoadModule
rewrite_module modules/mod_rewrite.so開啟(去掉#)
將對應目錄的AllowOverride 改為ALL
在根目錄下,即在index.php同級目錄下新建.htaccess

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

 設定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;),
			),
		),

推薦:《yii教學

以上是yii 1.0 index.php怎麼隱藏的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn