thinkphp報錯No input file specified. (對於隱藏url中的index.php 是如何做到的?)


thinkphp5

1.去除httpd.conf文件中"#LoadModule rewrite_module modules/mod_rewrite.so"前面的"#"號;

2.修改httpd.conf文件中的AllowOverride None為AllowOverride All,目的是支持.htaccess文件;

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

3.重啟apache sudo apachectl restart

4.修改public目錄下的.htaccess文件(有的apache服務器需要這一步)

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
改為
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]

最后.htaccess文件內容為: 

    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM