使用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>