Skip to content

Zeroplex 生活隨筆

軟體開發、伺服器和生活瑣事

小 縮小字型大小。 中 重設字型大小。 大 放大字型大小。

URL Rewrite for FuelPHP on Nginx

Posted on 2013 年 9 月 29 日2021 年 3 月 12 日 By 日落 在〈URL Rewrite for FuelPHP on Nginx〉中尚無留言

在 Nginx 設定檔預設值時,FuelPHP 的 URL 看起來是:

http://my.site/index.php/controller/param/

將 URL rewrite 成:

http://my.site/controller/param/

先改 Nginx 設定:

location / {
   try_files  $uri /index.php?$uri$args;
}

這樣能讓 Nginx 處理不含 index.php 的 URL,再來需要修改 FuelPHP 的設定,讓 Uri::create() 等產生的網址自動將 index.php 去掉。

修改 fuel/app/config/config.php:

return arary(
   //'index_file'  => 'index.php',
   'index_file'  => false,
);
Tags:FuelPHP, Nginx

文章導覽

Previous Post: Setting Vim from Command Line Argument
Next Post: List Disk Label

發佈留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *


其他

關於我  (About me)

小額贊助

  文章 RSS Feed

  留言 RSS Feed

Apache AWS Bash C/C++ Docker FreeBSD GCP Git Google Java JavaScript Laravel Linux Microsoft MSSQL MySQL Nginx PHP PHPUnit PostgreSQL Python Qt Ubuntu Unix Vim Web Windows WordPress XD 作業系統 分享 好站推薦 專題 攝影 新奇搞笑 新聞 旅遊 生活雜記 程式設計 網路架站 網頁設計 資訊學習 資訊安全 遊戲 音樂


創用 CC 授權條款
本著作係採用創用 CC 姓名標示-相同方式分享 4.0 國際 授權條款授權.