【问题标题】:Codeigniter remove index.php does not workCodeigniter 删除 index.php 不起作用
【发布时间】:2019-01-14 04:41:51
【问题描述】:

我使用iis服务器,我尝试了一些方法,但没有奏效;

config.php

$config['index_page'] = '';

.htaccess;

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>
<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

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

为什么 index.php 没有从 url 中删除?我怎样才能以另一种方式删除它?

【问题讨论】:

标签: .htaccess codeigniter


【解决方案1】:
DirectoryIndex index.php index.html

<IfModule mod_rewrite.c>

RewriteEngine On
# RewriteBase /yourfoler/
RewriteCond $1 !^(index\.php|assets|install|update) 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# For godady Shared Hosting Server uncomment the line below
RewriteRule ^(.*)$ index.php?/$1 [L]

# Please comment this if you have uncommented the above
# RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]

</IfModule>

重新编写Htaacess

【讨论】:

【解决方案2】:

你可以试试这个,请从 .htaccess 中删除所有代码并检查下面,我不确定,我认为它可以工作

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|install|update)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

【讨论】:

    【解决方案3】:

    试试这个

    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    

    它来自 Laravel,但也一直为我使用 CodeIgniter。

    【讨论】:

      猜你喜欢
      • 2014-08-12
      • 2013-12-29
      • 2020-02-10
      • 2021-04-11
      • 1970-01-01
      • 2018-07-12
      • 1970-01-01
      • 2011-08-03
      • 2014-08-19
      相关资源
      最近更新 更多