yii1.0隱藏index.php的方法:首先打開“httpd.conf”文件;然后開啟“mod_rewrite.so”;接著將相對(duì)應(yīng)目錄的“AllowOverride”改為ALL;最后在index.php同級(jí)目錄下新建.htaccess。
本文操作環(huán)境:windows7系統(tǒng)、yii1.0版,DELL G3電腦
YII 1.0 隱藏單入口index.php 設(shè)置路由與偽靜態(tài)
隱藏 index.php
保證apache配置文件httpd.conf里的LoadModule
rewrite_module modules/mod_rewrite.so開啟(去掉#)
將相對(duì)應(yīng)目錄的AllowOverride 改為ALL
在根目錄下,即在index.php同級(jí)目錄下新建.htaccess
立即學(xué)習(xí)“PHP免費(fèi)學(xué)習(xí)筆記(深入)”;
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
?設(shè)置main.php 中的路由規(guī)則
//?uncomment?the?following?to?enable?URLs?in?path-format 'urlManager'=>array( 'urlFormat'=>'path', ????????????'showScriptName'?=>false, 'rules'=>array( ????????????????'index.html'=>array('index'), ????????????????'article/<id:>'?=>?array('article/index','urlSuffix'=>'.html'), ????????????????'category/<id:>/<page:>'?=>?array('category/index','urlSuffix'=>'.html'), ????????????????'category/<id:>/1'?=>?array('category/index','urlSuffix'=>'.html'), ), ),</id:></page:></id:></id:>
推薦:《yii教程》
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載。
THE END