Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.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/1/typescript/8.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
Index.php从url删除在CI 3中不起作用_Php_.htaccess_Codeigniter - Fatal编程技术网

Index.php从url删除在CI 3中不起作用

Index.php从url删除在CI 3中不起作用,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,为了从url中删除index.php,我做了很多尝试。 它根本不起作用 在config.php中 $config['index_page']=''; $config['uri_protocol']='REQUEST_uri'; 然后将下面的代码放在我的项目根目录的.htaccess中 重新编写引擎打开 重写cond%{REQUEST_FILENAME}-F 重写cond%{REQUEST_FILENAME}-D 重写规则。*index.php/$1[PT,L] 我试过了,它的投掷页面只发现错

为了从url中删除index.php,我做了很多尝试。 它根本不起作用

在config.php中

$config['index_page']='';
$config['uri_protocol']='REQUEST_uri';
然后将下面的代码放在我的项目根目录的.htaccess中

重新编写引擎打开
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。*index.php/$1[PT,L]
我试过了,它的投掷页面只发现错误。

有什么建议吗??
谢谢

您需要更改
config.php
.htaccess
文件

application/config/config.php中的更改

$config['index_page'] = ""; // And Remove index.php
.htaccess中的更改

RewriteEngine on

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

  • 您的
    .htaccess
    必须位于
    cloud
    目录下

  • 必须在Apache中启用重写模块


  • 您需要更改
    config.php
    .htaccess
    文件

    application/config/config.php中的更改

    $config['index_page'] = ""; // And Remove index.php
    
    .htaccess中的更改

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

  • 您的
    .htaccess
    必须位于
    cloud
    目录下

  • 必须在Apache中启用重写模块

  • 试试这个,
    .htaccess中的更改

    RewriteEngine on
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    #RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
    
    <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]
    
    试试这个,
    .htaccess中的更改

    RewriteEngine on
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    #RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
    
    <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]
    
    确保您的重写引擎在apache conf文件中处于打开状态,如果没有,请遵循此链接


    确保您的重写引擎在apache conf文件中处于打开状态,如果没有,请遵循此链接


    您的基本URL不是基本域名,因此请修改.htaccess文件并添加以下内容:

    RewriteBase /cloud
    

    这将解决您的问题。

    您的基本URL不是基本域名,因此请修改.htaccess文件并添加以下内容:

    RewriteBase /cloud
    

    这将解决您的问题。

    可能与.htaccess RewriteBase重复/cloud@JamesLalor,非常感谢你为我做的工作。谢谢对你来说还不够。:)@sradha写了一个答案,请标记为已接受。可能与.htbase重复/cloud@JamesLalor,非常感谢你为我做的工作。谢谢对你来说还不够。:)@sradha写了一个答案,请标记为已接受。它在本地主机上。我不能给你看。我想删除index.php链接@sradha请签入
    application/config/routes.php
    default\u控制器应该是
    $route['default\u controller']='dashboard'但我的默认控制器是登录,第一个登录页面将出现,所以我给出了login@sradha登录是否在url中没有
    index.php
    的情况下工作?如果我给出登录页面,则是。正如我提到的$route['default_controller']='Login';它在本地主机上。我不能给你看。我想删除index.php链接@sradha请签入
    application/config/routes.php
    default\u控制器应该是
    $route['default\u controller']='dashboard'但我的默认控制器是登录,第一个登录页面将出现,所以我给出了login@sradha登录是否在url中没有
    index.php
    的情况下工作?如果我给出登录页面,则是。正如我提到的$route['default_controller']='Login';