Yii2开启enableprettyurl(url美化)无效
2024-10-18 20:21:17
最终显示的url格式为:http://localhost/yii2/frontend/web/site/about
在/config/main.php中 ’components‘=>[] 中添加如下代码:
'urlManager' => [
'enablePrettyUrl' => true,//将?r=site%2Fabout美化为/site/about
'showScriptName' => false,//隐藏index.php
'rules' => [
],
],
还需在index.php入口文件同级的目录下添加.htaccess文件:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
最新文章
- Chrome浏览器快捷键大全(新加了其他一些浏览器的独有)
- atitit groovy 总结java 提升效率
- HDU 2487 Ugly Windows
- Thread的六种状态
- Supervisor 守护 dotnetcore 程序
- CSS 实现:父元素包含子元素,子元素垂直居中布局
- ASP.NET设置404页面返回302HTTP状态码的解决方法
- iOS获取图片的Base64String,兼容Android,java,web,jpg(jpeg),png
- C# Coding &; Naming Conventions
- 五笔拼音反查精灵 v6.69 绿色版
- iOS触摸事件深入
- js二维码插件总结
- UVA 1626 Brackets sequence 区间DP
- 衡量android开发者水平的面试问题-android学习之旅(91)
- Connection 对象简介 方法解读 JDBC简介(四)
- C语言--第4次作业
- Mac搭建SVN服务器+Cornerstone连接服务器
- poj3061 Subsequence(尺取法)
- HTML常用标签定义,用法及例子
- BZOJ1146[CTSC2008]网络管理——出栈入栈序+树状数组套主席树
热门文章
- [deviceone开发]-do_Webview的基本示例
- [deviceone开发]-do_Webview加载JQueryMobile的示例
- 多页的TIFF图片在aspx页面分页显示
- ArcGIS Engine开发之地图基本操作(2)
- Python导入其他文件中的.py文件 即模块
- 版本控制-Git服务器搭建和常用命令使用
- python快速生成注释文档的方法
- 使用selenium编写脚本常见问题(一)
- hadoopfs: 未找到命令...
- 跨应用使用Spoon框架截图的方法