【apache】phpstudy中apache 隐藏入口文件index.php (解决no input file specified错误)

步骤:

下面我说下 apache 下 ,如何 去掉URL 里面的 index.php 
例如: 你原来的路径是: localhost/index.php/Index/index
改变后的路径是: localhost/Index/index

1.httpd.conf配置文件中加载了mod_rewrite.so模块 //在APACHE里面去配置 
#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉 

2.在APACHE里面去配置 ,将里面的AllowOverride None都改为AllowOverride All

注意:修改之后一定要重启apache服务。 

3.确保URL_MODEL设置为2, (url重写模式)

在项目的配置文件里写 

return Array( 
‘URL_MODEL’ => ’2′, 
); 
4 新建文件名为 .htaccess 的文件,放于根目录下,内容如下: 

方法一:在RewriteRule后面的index.php之后加?(建议)

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
 
</IfModule> 

或者方法二:(不建议)

在php.ini中找到

;cgi.force_redirect = 1

去掉前面的分号并且把后面的1改为0

原文地址:https://www.cnblogs.com/xuzhengzong/p/9254994.html