首頁 > php框架 > YII > 主體

yii 1.0 index.php怎麼隱藏

藏色散人
發布: 2023-01-13 00:40:36
原創
6086 人瀏覽過

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'),
                'article/' => array('article/index','urlSuffix'=>'.html'),
                'category//' => array('category/index','urlSuffix'=>'.html'),
                'category//1' => array('category/index','urlSuffix'=>'.html'),
			),
		),
登入後複製

推薦:《yii教學

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

相關標籤:
yii
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!