1、在配置文件 main.php 中添加
~~~
'urlManager' => [
//用于URL路徑化
'enablePrettyUrl' => true,
//指定是否在URL在保留入口腳本 index.php
'showScriptName' => false,
],
~~~
2. vhosts.conf 配置
添加下面這句話到vhosts里
~~~
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
~~~
參考:
~~~
server {
listen 80;
server_name frontend.com ;
root "E:/phpStudy/WWW/Project/advanced/frontend/web";
location / {
index index.html index.htm index.php;
#autoindex on;
#在這里添加這一行
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
~~~
- 前文
- 安裝前的準備
- windows安裝Composer
- Linux安裝Composer
- 開始使用
- 安裝yii2.0
- 初始化項目
- 檢測運行環境
- 數據庫
- 連接數據庫
- 添加
- 查詢
- join
- joinWith
- with
- asArray
- offset
- filterWhere
- 關聯查詢
- 更新
- AR更新
- with和JoinWith的區別?
- Yii2.0框架基礎--數據查詢之AR類方法一
- 數據庫遷移Migration
- 查看最后執行SQL語句
- 事務處理
- 例子
- 控制器
- rules驗證方法
- behaviors行為
- actions動作
- 模型
- 模型使用
- attributeLabels
- tableName
- fields
- 視圖
- 顯示視圖
- 獲取配置參數
- 格式化時間顯示
- Activeform效果
- Activeform表單部分組件使用方法
- RESTful服務
- 版本化控制
- 郵件mail
- 郵件配置
- 郵件樣板
- session
- Yii2.0 Session操作大全(增、刪、改、銷毀、Session數組賦值、讀取)
- 緩存
- 跨APP讀取緩存(文件緩存)
- Memcache
- 最佳實踐
- 控制器
- 模型
- 視圖
- 常見問題
- 解決根目錄沒有vendor目錄
- 安裝composer-asset插件錯誤
- Url隱藏index.php
- nginx配置
- Apache配置
- 配置
- 設置系統默認中文提示
- 數據庫問題
- where和andWhere不能同時使用嗎?
- debug
- 編輯器使用技巧
- phpstorm
- Redis
- redis安裝
- redis例子
- RBAC
- Redis和memcache概念
- 生成接口文檔
- Swagger安裝
- Swagger語法
- 擴展
- 七牛云存儲
- 視頻縮略圖
- Pjax
- A鏈接不能跳轉解決辦法