您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

yii框架的路由如何配置

2026/1/31 19:36:23发布37次查看
首先要在服务器配置(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 # 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</directory>
(相关教程推荐:yii框架)
在目录下加入服务器配置文件.htaccess
rewriteengine on################################ @email test@test.com# @author test################################重写规则#如果是一个目录或者文件,就访问目录或者文件rewritecond %{request_filename} !-d#如果文件存在,就直接访问文件,不进行下面的rewriterulerewritecond %{request_filename} !-frewriterule . index.php
在框架配置项\frontend\config\main.php中加入urlmanager配置项
'urlmanager' => [ 'enableprettyurl' => true, 'showscriptname' => false, //'suffix' => '.html',//url后缀],
重启服务器。
更多编程相关内容,请关注编程入门栏目!
以上就是yii框架的路由如何配置的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product