APACHE支持.htaccess以及 No input file specified解决方案
2015-11-10 12:21
423 查看
本文转自:http://www.cr173.com/html/19352_1.html
在你的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”前面多加了一个“?”号,问题也就随之解决了。
在你的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”前面多加了一个“?”号,问题也就随之解决了。
相关文章推荐
- Apache增加mod_expires模块+配置指南
- Apache错误页面404配置
- Apache的Rewrite规则详细介绍
- 如何从Apache官网下载windows版apache服务器
- (总结)隐藏Apache版本号的必要性与方法
- wampserver的apache服务无法启动
- Ubuntu 14.04 Apache2 支持中文文件名
- Centos linux 下配置 apache ,创建虚拟网站访问路径
- 跨多编程语言编程工具---Apache Thrift
- 天下数据分享保障Apache WEB服务器的技巧
- Apache的Win基本配置
- spring集成Apache的ActiveMQ
- apache2: Could not reliably determine the server's fully qualified domain name
- Apache ActiveMQ消息中间件的基本使用
- apache使用ssl数字证书
- php和apache安装心得
- 无法访问SingleBody 找不到org.apache.james.mime4j.messag
- apache kafka监控系列-KafkaOffsetMonitor(转)
- Apache的请求处理过程
- 在Mac下配置php开发环境:Apache+php+MySql