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]
posted @ 2016-07-22 10:01  hereim  阅读(1946)  评论(0编辑  收藏  举报