問題描述:使用TP框架做項目時,在啟用REWRITE的偽靜態功能的時候,首頁可以訪問,但是訪問其它頁面的時候,就提示:“No input file specified.”
原因在于使用的PHP5.6是fast_cgi模式,而在某些情況下,不能正確識別path_info所造成的錯誤
默認的.htaccess里面的規則:
IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
“No input file specified.”,是沒有得到有效的文件路徑造成的。
修改后的偽靜態規則,如下: IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
僅僅就是在正則結果“/$1”前面多加了一個“?”號,問題也就隨之解決了。
|