删除“;index.php“;来自Codeigniter.htacceess

删除“;index.php“;来自Codeigniter.htacceess,php,.htaccess,codeigniter,frameworks,subdomain,Php,.htaccess,Codeigniter,Frameworks,Subdomain,我已经在Codeigniter中工作了几天了&一切都很顺利,接受我一辈子都无法摆脱url中的index.php(从localhost/index.php/controller到localhost/controller) 我使用的是CIs default index.php 在apache中启用了重写 $config['index_page'] = ""; $config['uri_protocol'] = 'AUTO'; (尽管我已经尝试了URI的其他四种设置) .htaccess看起来像这样

我已经在Codeigniter中工作了几天了&一切都很顺利,接受我一辈子都无法摆脱url中的index.php(从localhost/index.php/controller到localhost/controller)

我使用的是CIs default index.php

在apache中启用了重写

$config['index_page'] = "";
$config['uri_protocol'] = 'AUTO';
(尽管我已经尝试了URI的其他四种设置)

.htaccess看起来像这样

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

  RewriteCond $1 !^(index\.php|resources|robots\.txt)
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]

  <Files "index.php">
    AcceptPathInfo On
  </Files>
</IfModule>

<IfModule !mod_rewrite.c>
  ErrorDocument 404 /index.php
</IfModule>

重新启动发动机
重写基/
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]
上的AcceptPathInfo
ErrorDocument 404/index.php
我试过答案了 和

帮助会很好

多谢各位

附言。
如果有必要,我正在子域中工作。

将以下规则放入.htaccess文件中

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]  
如果上面的行不起作用,则需要打开CI配置文件application/config/config.php

在这一行中,找到以下行

$config['index_page'] = 'index.php';
改为:

$config['index_page'] = '';
如果不起作用,则尝试在配置中将uri_协议更改为自动:

$config['uri_protocol'] = 'AUTO';

在.htaccess中,这可能是一个问题
RewriteCond$1^(indew\.php | resources | robots\.txt)

并确保已启用“重写”模块
或者对于重写规则行,尝试将其更改为

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

(index.php之前的
/

您编写了
indew
而不是
index
-这可能是您的问题吗?我的帖子中输入了错别字,但不是实际的文件,我检查了,但谢谢您,您的CI安装在哪里?我做了所有这些(请看我上面发布的内容)。仍然不起作用我只是仔细检查了一下,重写模式被启用了。打字错误在我的帖子里不是真实的文件,但我还是试着把这一行全部删除了,仍然没有什么…补充了另一个建议。