小編給大家分享一下yii框架配置路由的方法,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!
首先要在服務(wù)器配置(httpd.conf)中開啟重寫模塊:
#開啟重寫模塊,將其前面的#去掉 LoadModule rewrite_module modules/mod_rewrite.so #Directory中允許覆蓋開啟 <Directory "${SRVROOT}/htdocs"> # # 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 # /tupian/20230522/core.html # 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 </Directory>
(推薦教程:yii框架)
在目錄下加入服務(wù)器配置文件.htaccess
RewriteEngine on ############################### # @email test@test.com # @author test ############################### #重寫規(guī)則 #如果是一個目錄或者文件,就訪問目錄或者文件 RewriteCond %{REQUEST_FILENAME} !-d #如果文件存在,就直接訪問文件,不進行下面的RewriteRule RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php
在框架配置項\frontend\config\main.php中加入urlManager配置項
'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, //'suffix' => '.html',//URL后綴],
看完了這篇文章,相信你對yii框架配置路由的方法有了一定的了解,想了解更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!
新聞名稱:yii框架配置路由的方法-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://www.chinadenli.net/article40/igpeo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、云服務(wù)器、網(wǎng)站導(dǎo)航、關(guān)鍵詞優(yōu)化、電子商務(wù)、域名注冊
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容