Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter从浏览器Url中删除index.php_Php_.htaccess_Codeigniter_Url_Iis 8.5 - Fatal编程技术网

Codeigniter从浏览器Url中删除index.php

Codeigniter从浏览器Url中删除index.php,php,.htaccess,codeigniter,url,iis-8.5,Php,.htaccess,Codeigniter,Url,Iis 8.5,我想创建一个应用程序url“”。但输入url时,会显示“HTTP错误403.14-禁止”。当我在url(如“”的最后一个)插入'index.php'时,登录页将在浏览器中呈现 我改变了主意 $config['base_url'] = 'http://example.com'; $config['index_page'] = ''; 及 $config['uri_protocol'] = 'REQUEST_URI'; 在config.php文件中。然后,我将.htaccess文件与应用程序和

我想创建一个应用程序url“”。但输入url时,会显示“HTTP错误403.14-禁止”。当我在url(如“”的最后一个)插入'index.php'时,登录页将在浏览器中呈现 我改变了主意

$config['base_url'] = 'http://example.com';

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';
在config.php文件中。然后,我将.htaccess文件与应用程序和系统文件夹一起放在codeigniter根文件夹中。然后在我使用的.htaccess文件中

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

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php/$1[L]
我只想从url中删除'index.php'。我正在使用IIS 8.5 web服务器。

替换此行:-

$config['uri_protocol'] = 'REQUEST_URI';
to
$config['uri_protocol'] = 'AUTO';
还可以如下更改您的基本url

$config['base_url']    = 'http://'.$_SERVER['HTTP_HOST'].'/';
将规则写在下面:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
希望它对您有用:)

在config.php中

删除$config['index_page'中的index.php

例如:


$config['index_page']=''

很抱歉,我不能给你一个确切的答案,因为没有任何经验与IIS。但这里列出了几个答案。第二个答案对我有效。您可以尝试的另一件事是编辑.htaccess多一点“RewriteEngine on RewriteBase/RewriteRule^(application | system | \.svn)index.php/$1[L]RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-RewriteRule^(.$index.php/$1[QSA,L]),我已经这样做了,但没有起作用。apache和iis是否以相同的方式工作?似乎不是:那么试试这个。实际上,您似乎还需要URL重写模块,并且规范(conf)看起来与apache不同。您使用的CI版本是什么?我使用您的代码“RewriteEngine on RewriteBase/RewriteRule^(application | system | \.svn)index.php/$1[L]RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST u FILENAME}编辑了.htaccess!-d rewrited rule^(.*)$index.php/$1[QSA,L]”和o/p是相同的“HTTP错误403.14-禁止”它也导致了相同的结果。为什么将“$config['uri_protocol']='REQUEST_uri';”更改为“$config['uri_protocol']='AUTO'”,仍然显示相同的错误。我是否更改了根目录中的index.php文件
  htaccess file
  RewriteEngine on
  RewriteCond $1 !^(index\.php|resources|robots\.txt)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]

  my site is working http://demo.crowdfundingscript.com/ 
  config file
  $config['uri_protocol']   = 'AUTO';
   $config['index_page'] = '';