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

简介: 你的Apache安装文件夹conf里找到httpd.conf文件 索LoadModule rewrite_module modules/mod_rewrite.so 如果前面有注释符号#,请去掉。 搜索Options FollowSymLinks,然后将它下面的AllowOverride None 修改为AllowOverride All; 【1】 没想到遇见了 N
+关注继续查看

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

索LoadModule rewrite_module modules/mod_rewrite.so 如果前面有注释符号#,请去掉。
搜索Options FollowSymLinks,然后将它下面的AllowOverride None 修改为AllowOverride All;

【1】

没想到遇见了 No input file specified   因为项目用了URL route ,估摸着可能是rewrite的问题。

记录一下解决方案。

1.检查doc_root 是否设置此值

2.检查.hta文件 , 很多框架都是index.php当入口文件。

默认的

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

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

修改成

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”前面多加了一个“?”号,问题也就随之解决了。

相关文章
|
1月前
|
数据采集 分布式计算 Hadoop
开源数据质量解决方案——Apache Griffin入门宝典(上)
开源数据质量解决方案——Apache Griffin入门宝典
|
2月前
|
存储 安全 Java
【Shiro】Apache Shiro 默认密钥致命令执行漏洞(CVE-2016-4437)的解决方案
【Shiro】Apache Shiro 默认密钥致命令执行漏洞(CVE-2016-4437)的解决方案
50 0
|
3月前
|
XML Java Apache
Apache Maven:从构建到部署,一站式解决方案
Apache Maven:从构建到部署,一站式解决方案
70 0
|
11月前
|
Apache
【解决方案】No input file specified. Apache解决方案
【解决方案】No input file specified. Apache解决方案
80 0
【解决方案】No input file specified. Apache解决方案
|
应用服务中间件 Apache
apache作为web应用服务器允许列出目录解决方案
apache作为web应用服务器允许列出目录解决方案
184 0
apache作为web应用服务器允许列出目录解决方案
|
安全 Java 测试技术
Apache Log4j 远程代码执行漏洞的响应 (CVE-2021-44228)--vCenter Server6.5实践--临时解决方案
Apache Log4j 远程代码执行漏洞的响应 (CVE-2021-44228)核弹级漏洞,在VMware补丁没出之前,根据官方临时缓解办法总结出的方案
432 0
Apache Log4j 远程代码执行漏洞的响应 (CVE-2021-44228)--vCenter Server6.5实践--临时解决方案
热门文章
最新文章
相关产品
机器翻译
推荐文章
更多
推荐镜像
更多