YII框架路由配置
2024-09-02 15:06:58
- 首先要在服务器配置(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> - 在目录下加入服务器配置文件.htaccess
RewriteEngine on ###############################
# @email test@test.com
# @author test
############################### #重写规则
#如果是一个目录或者文件,就访问目录或者文件
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后缀
], - 对了,修改完服务器配置不要忘了重启服务器,有啥错误看服务器日志,这个很关键
最新文章
- 网页游戏外挂辅助AMF模拟通讯必备
- SQL*Loader之CASE5
- 重绘TabControl
- MS Sql Server 中主从库的配置和使用介绍(转)
- opencv在VS2010命令行编译过程
- pt-query-digest 安装及使用
- javascript 高级程序设计 学习笔记
- Java虚拟机-类文件
- Trie树(字典树)推荐文章
- Node版本管理工具-NVM的安装与使用(windows系统)
- IIS启动应用程序池报错";服务无法在此时接受控制信息";
- spring-boot-2.0.3启动源码篇三 - run方法(二)之prepareEnvironment
- Jmeter之csv参数化
- 关于Redis缓存数据库
- 阿里云配置ssl证书
- Linux进程概述
- (转)linux下压缩和归档相关命令tar,zip,gzip,bzip2
- 盒子模型 以及CSS的box-sizing属性。
- 第二篇、HTML
- hdu 3478 Catch 二分图染色
热门文章
- Python短路原则
- linux上 查看mysql的binglog日志
- “全栈2019”Java第十七章:赋值运算符和算术运算符
- 洛谷P5205 【模板】多项式开根(FFT)
- [bzoj2816][ZJOI2012]网络(LCT,splay)
- 并发编程---线程 ;python中各种锁
- 【算法】C++用链表实现一个箱子排序附源代码详解
- 二叉搜索树 思想 JAVA实现
- ES6 (一)变量声明方法 &; 解构赋值
- SpringBoot 启动的时候提示 Field *** in *** required a bean named &#39;entityManagerFactory&#39; that could not be found.