小編給大家分享一下yii框架配置路由的方法,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!
公司主營(yíng)業(yè)務(wù):成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)、移動(dòng)網(wǎng)站開(kāi)發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開(kāi)放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來(lái)的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來(lái)驚喜。創(chuàng)新互聯(lián)推出新市免費(fèi)做網(wǎng)站回饋大家。
首先要在服務(wù)器配置(httpd.conf)中開(kāi)啟重寫(xiě)模塊:
#開(kāi)啟重寫(xiě)模塊,將其前面的#去掉 LoadModule rewrite_module modules/mod_rewrite.so #Directory中允許覆蓋開(kāi)啟# # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Require all granted
(推薦教程:yii框架)
在目錄下加入服務(wù)器配置文件.htaccess
RewriteEngine on ############################### # @email test@test.com # @author test ############################### #重寫(xiě)規(guī)則 #如果是一個(gè)目錄或者文件,就訪問(wèn)目錄或者文件 RewriteCond %{REQUEST_FILENAME} !-d #如果文件存在,就直接訪問(wèn)文件,不進(jìn)行下面的RewriteRule RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php
在框架配置項(xiàng)\frontend\config\main.php中加入urlManager配置項(xiàng)
'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, //'suffix' => '.html',//URL后綴],
看完了這篇文章,相信你對(duì)yii框架配置路由的方法有了一定的了解,想了解更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!