thinkphp中index.php隐藏后非默认的操作方法出现No input file specified

因为在Fastcgi模式下,php不支持rewrite的目标网址的PATH_INFO的解析
ThinkPHP运行在URL_MODEL=2时,会出现 No input file specified.的情况,
这时可以修改网站目录的.htaccess文件:
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 
改为 RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L] 
 
完整的.htaccess代码为:
  1.  
    <IfModule mod_rewrite.c>
      Options +FollowSymlinks
      RewriteEngine On
    
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
      RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
    </IfModule>

    别忘了apache中httpd.conf配置文件中加载mod_rewrite.so模块,并将AllowOverride None 的None改为 All

猜你喜欢

转载自www.cnblogs.com/dayudarou/p/11565726.html