使用ip地址访问时删除index.php

使用ip地址访问时删除index.php,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,我在服务器上上载了codeigniter项目。从URL中删除index.php不起作用。我使用IP地址访问它。类似地址/ 下面是我的访问权限 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.

我在服务器上上载了codeigniter项目。从URL中删除index.php不起作用。我使用IP地址访问它。类似地址/

下面是我的访问权限

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    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]
/etc/apache2/apache2.conf

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

选项索引跟随符号链接
允许超越所有
要求所有授权

我尝试了在谷歌上找到的所有可能的解决方案。但不适用于我。

在httpd.conf中,编辑或删除“index.php”:


DirectoryIndex.php

在httpd.conf中,编辑或删除“index.php”:


DirectoryIndex.php

在.htaccess中添加以下代码。希望这能奏效

Options All -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

在.htaccess中添加以下代码。希望这能奏效

Options All -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

请遵循以下步骤:

  • 转到应用程序/config/config.php: 替换
    $config['index_page']='index.php'
    $config['index_page']=''
    $config['uri_protocol']='REQUEST_uri'
    $config['uri_protocol']='AUTO'

  • 通过
    sudo a2enmod重写
    然后
    服务apache2重启

  • 如果愿意,可以使用以下.htaccess文件

  • 
    重新启动发动机
    重写基/
    重写cond%{REQUEST_FILENAME}-F
    重写cond%{REQUEST_FILENAME}-D
    重写规则/index.php[L]
    

    请执行以下步骤:

  • 转到应用程序/config/config.php: 替换
    $config['index_page']='index.php'
    $config['index_page']=''
    $config['uri_protocol']='REQUEST_uri'
    $config['uri_protocol']='AUTO'

  • 通过
    sudo a2enmod重写
    然后
    服务apache2重启

  • 如果愿意,可以使用以下.htaccess文件

  • 
    重新启动发动机
    重写基/
    重写cond%{REQUEST_FILENAME}-F
    重写cond%{REQUEST_FILENAME}-D
    重写规则/index.php[L]
    

    如下设置
    .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]
    

    然后打开
    /etc/httpd/conf/http.conf
    文件,在此查找中查找
    ,并将
    AllowOverride None
    设置为
    AllowOverride All

    如下设置
    .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]
    

    然后打开
    /etc/httpd/conf/http.conf
    文件,在此查找中查找
    ,并将
    AllowOverride None
    设置为
    AllowOverride All

    我找不到httpd.conf,只有apache2.conf在/etc/apache2I中我找不到httpd.conf,只有apache2.conf在/etc/apache2中,直到同一个发行人config.php和替换为空白$config['index_page']=“”;仍然相同的issuepen config.php并替换为空白$config['index_page']=”;