Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.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”时,我被重定向到domain.ltd(在chrome中)_Php_.htaccess_Codeigniter_Url_Url Rewriting - Fatal编程技术网

当我试图从codeigniter URL中删除“Index.php”时,我被重定向到domain.ltd(在chrome中)

当我试图从codeigniter URL中删除“Index.php”时,我被重定向到domain.ltd(在chrome中),php,.htaccess,codeigniter,url,url-rewriting,Php,.htaccess,Codeigniter,Url,Url Rewriting,我试图通过从我的URL中删除index.php使我的网站的URL更干净、搜索引擎优化更友好,但意外的结果发生了,这是我的.htaccess文件: <IfModule mod_rewrite.c> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / ### Canonicalize codeigniter URLs RewriteRule ^(site(/index)?|i

我试图通过从我的URL中删除index.php使我的网站的URL更干净、搜索引擎优化更友好,但意外的结果发生了,这是我的.htaccess文件:

<IfModule mod_rewrite.c>
<IfModule mod_rewrite.c>


    RewriteEngine On
    RewriteBase /

    ### Canonicalize codeigniter URLs


    RewriteRule ^(site(/index)?|index(\.php)?)/?$ / [L,R=301]
    RewriteRule ^(.*)/index/?$ $1 [L,R=301]

    # Removes trailing slashes (prevents SEO duplicate content issues)
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ $1 [L,R=301]

</IfModule>

<IfModule !mod_rewrite.c>

    # Without mod_rewrite, route 404's to the front controller
    ErrorDocument 404 /index.php

</IfModule>  
控制器是:site.php。

要尝试三件事: 是否从config.php文件中删除index.php

您是否尝试过直接使用CI提供的htacces

将$config['uri_protocol']设置为'AUTO';或查询字符串

直接从用户指南: 删除index.php文件

默认情况下,index.php文件将包含在URL中:

example.com/index.php/news/article/my_article

通过将.htaccess文件与一些 简单的规则。下面是这样一个文件的示例,使用负片 方法,在该方法中,除了指定的项之外,所有内容都被重定向:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
在上面的示例中,除了index.php之外的任何HTTP请求, 图像和robots.txt被视为对index.php的请求 文件


是的,我这样做了:$config['index_page']=;意外的结果发生了。如果你能告诉我们发生了什么意外的结果,那就太好了。