APACHE支持.htaccess以及 No input file specified解决方案

 

你的Apache安装文件夹conf里找到httpd.conf文件php

索LoadModule rewrite_module modules/mod_rewrite.so 若是前面有注释符号#,请去掉。
搜索Options FollowSymLinks,而后将它下面的AllowOverride None 修改成AllowOverride All;apache

【1】框架

没想到碰见了 No input file specified   由于项目用了URL route ,估摸着多是rewrite的问题。ide

记录一下解决方案。搜索引擎

1.检查doc_root 是否设置此值索引

2.检查.hta文件 , 不少框架都是index.php当入口文件。ci

默认的input

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]it

规则在apache fastcgi模式下会致使No input file specified.io

修改为

RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

就OK,地址正常重写。

 

【2】

咱们都知道,使用伪静态相对来讲,对搜索引擎比较友好,而我在Dreamhost的空间上启用REWRITE的伪静态功能的时候,首页能够访问,而访问内页的时候,就提示:“No input file specified.”。
百度搜索了一下,发现还有其它空间商也有此问题,缘由在于空间所使用的PHP是fast_cgi模式,而在某些状况下, 不能正确识别path_info所形成的错误,就是Wordpress也有同样的问题,还好找到了解决方案!
咱们首先来看一下Wordpress及Typecho等程序默认的.htaccess里面的规则:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

而提示是说:“No input file specified.”,也就是说没有获得有效的文件路径。在Google中找到了解决方案,就是修改一下伪静态规则,以下:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

在正则结果“$1”前面多加了一个“?”号,问题也就随之解决了。 

相关文章
相关标签/搜索