1. 程式人生 > >ThinkPHP5.X PHP5.6.27-nts + Apache 通過 URL 重寫來隱藏入口檔案 index.php

ThinkPHP5.X PHP5.6.27-nts + Apache 通過 URL 重寫來隱藏入口檔案 index.php

我們先來看看官方手冊給出關於「URL 重寫」的參考:

可以通過 URL 重寫隱藏應用的入口檔案 index.php ,Apache 的配置參考:

1、http.conf 配置檔案載入 mod_rewrite.so 模組
2、AllowOverride Node 中將 None 改為 All
3、將下面的內容儲存為 .htaccess 放置入口檔案同級目錄下


<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>

最後,我通過修改 ThinkPHP 入口檔案同級目錄下的 .htaccess 檔案完成了救贖~

以上能解決出現 No input file specified 錯誤。

原文地址:https://segmentfault.com/a/1190000015681142