您好,欢迎访问一九零五行业门户网

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 # 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框架如何配置路由的详细内容。
其它类似信息

推荐信息