這篇文章主要介紹yii框架的路由怎么配置,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
首先要在服務器配置(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框架)
在目錄下加入服務器配置文件.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框架的路由怎么配置”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
分享題目:yii框架的路由怎么配置-創(chuàng)新互聯(lián)
文章轉載:http://m.rwnh.cn/article46/gggeg.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供面包屑導航、營銷型網(wǎng)站建設、關鍵詞優(yōu)化、定制開發(fā)、外貿網(wǎng)站建設、ChatGPT
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)