thinkphp配置rewrite模式訪問時不生效 出現No input file specified解決方法

使用thinkphp配置rewire模式的路徑訪問網站時,php

直接複製官網的.htaccess文件的代碼複製過去thinkphp

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

  

出現No input file specified 頁面提示,apache

在apache配置文件httpd-conf搗騰了好一陣子,ide

都沒有解決到,突然想到本地測試用的php運行模式是FastCGI模式,
測試

在此模式下如下重寫規則不適用的網站

^(.*)$ index.php/$1 [QSA,PT,L]

  

應該改爲spa

^(.*)$ index.php?s=$1 [QSA,PT,L]
因此.htaccess文件的代碼爲
1 <IfModule mod_rewrite.c>
2     RewriteEngine on
3     RewriteCond %{REQUEST_FILENAME} !-d
4     RewriteCond %{REQUEST_FILENAME} !-f
5     RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
6 </IfModule>
View Code
相關文章
相關標籤/搜索