Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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
.htaccess 如何在XAMPP上使用Codeigniter删除index.php?_.htaccess_Codeigniter_Indexing_Routes_Xampp - Fatal编程技术网

.htaccess 如何在XAMPP上使用Codeigniter删除index.php?

.htaccess 如何在XAMPP上使用Codeigniter删除index.php?,.htaccess,codeigniter,indexing,routes,xampp,.htaccess,Codeigniter,Indexing,Routes,Xampp,我无法在XAMPP1.7.3上隐藏Codeigniter index.php 网址: http://localhost/Servidor/agentesRainbow/index.php/agentes/tony <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /Servidor/agentesRainbow/ #'system' can be replaced if

我无法在XAMPP1.7.3上隐藏Codeigniter index.php

网址:

http://localhost/Servidor/agentesRainbow/index.php/agentes/tony
   <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /Servidor/agentesRainbow/

        #'system' can be replaced if you have renamed your system folder.
        RewriteCond %{REQUEST_URI} ^system.*
        RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]

        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d

        #This last condition enables access to the images and css folders, and the robots.txt file
       RewriteCond $1 !^(index\.php|images|css|public|)
       RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
        </IfModule>

    <IfModule !mod_rewrite.c>
        # If we don't have mod_rewrite installed, all 404's
        # can be sent to index.php, and everything works as normal.
        ErrorDocument 404 /application/errors/404.php
    </IfModule>
$route['agentes/(:any)'] = "agentes/index/$1";

$route['default_controller'] = "agentes";
$route['scaffolding_trigger'] = "";
$config['base_url'] = "http://localhost/Servidor/agentesRainbow/";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory /Servidor/agentesRainbow/>
         Options FollowSymLinks
         AllowOverride All
         Order deny,allow
         Deny from all
</Directory>
托尼是个辩论家

我的实际.htaccess:

http://localhost/Servidor/agentesRainbow/index.php/agentes/tony
   <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /Servidor/agentesRainbow/

        #'system' can be replaced if you have renamed your system folder.
        RewriteCond %{REQUEST_URI} ^system.*
        RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]

        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d

        #This last condition enables access to the images and css folders, and the robots.txt file
       RewriteCond $1 !^(index\.php|images|css|public|)
       RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
        </IfModule>

    <IfModule !mod_rewrite.c>
        # If we don't have mod_rewrite installed, all 404's
        # can be sent to index.php, and everything works as normal.
        ErrorDocument 404 /application/errors/404.php
    </IfModule>
$route['agentes/(:any)'] = "agentes/index/$1";

$route['default_controller'] = "agentes";
$route['scaffolding_trigger'] = "";
$config['base_url'] = "http://localhost/Servidor/agentesRainbow/";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory /Servidor/agentesRainbow/>
         Options FollowSymLinks
         AllowOverride All
         Order deny,allow
         Deny from all
</Directory>
My config.php:

http://localhost/Servidor/agentesRainbow/index.php/agentes/tony
   <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /Servidor/agentesRainbow/

        #'system' can be replaced if you have renamed your system folder.
        RewriteCond %{REQUEST_URI} ^system.*
        RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]

        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d

        #This last condition enables access to the images and css folders, and the robots.txt file
       RewriteCond $1 !^(index\.php|images|css|public|)
       RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
        </IfModule>

    <IfModule !mod_rewrite.c>
        # If we don't have mod_rewrite installed, all 404's
        # can be sent to index.php, and everything works as normal.
        ErrorDocument 404 /application/errors/404.php
    </IfModule>
$route['agentes/(:any)'] = "agentes/index/$1";

$route['default_controller'] = "agentes";
$route['scaffolding_trigger'] = "";
$config['base_url'] = "http://localhost/Servidor/agentesRainbow/";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory /Servidor/agentesRainbow/>
         Options FollowSymLinks
         AllowOverride All
         Order deny,allow
         Deny from all
</Directory>
httpd.conf上的

http://localhost/Servidor/agentesRainbow/index.php/agentes/tony
   <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /Servidor/agentesRainbow/

        #'system' can be replaced if you have renamed your system folder.
        RewriteCond %{REQUEST_URI} ^system.*
        RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]

        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d

        #This last condition enables access to the images and css folders, and the robots.txt file
       RewriteCond $1 !^(index\.php|images|css|public|)
       RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
        </IfModule>

    <IfModule !mod_rewrite.c>
        # If we don't have mod_rewrite installed, all 404's
        # can be sent to index.php, and everything works as normal.
        ErrorDocument 404 /application/errors/404.php
    </IfModule>
$route['agentes/(:any)'] = "agentes/index/$1";

$route['default_controller'] = "agentes";
$route['scaffolding_trigger'] = "";
$config['base_url'] = "http://localhost/Servidor/agentesRainbow/";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory /Servidor/agentesRainbow/>
         Options FollowSymLinks
         AllowOverride All
         Order deny,allow
         Deny from all
</Directory>
LoadModule rewrite\u module modules/mod\u rewrite.so
选项如下符号链接
不允许超限
命令拒绝,允许
全盘否定
选项如下符号链接
允许超越所有
命令拒绝,允许
全盘否定

将此行添加到请求文件名条件中:

RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
以下是更新的.htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /Servidor/agentesRainbow/

    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]

    #This last condition enables access to the images and css folders, and the robots.txt file
    RewriteCond $1 !^(index\.php|images|css|public)
    RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    ErrorDocument 404 /application/errors/404.php
</IfModule>

重新启动发动机
RewriteBase/Servidor/agentesRainbow/
#如果已重命名系统文件夹,则可以替换“系统”。
重写COND%{REQUEST_URI}^系统*
重写规则^(.*)$/Servidor/agentesRainbow/index.php/$1[L]
#检查用户是否试图访问有效文件,
#例如图像或css文档,如果这不是真的,它会发送
#请求index.php
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/Servidor/agentesRainbow/index.php/$1[L]
#最后一个条件允许访问图像和css文件夹以及robots.txt文件
1美元^(索引\.php |图像| css |公共)
重写规则^(.*)$/Servidor/agentesRainbow/index.php/$1[L]
#如果我们没有安装mod_rewrite,所有404
#可以发送到index.php,一切正常。
ErrorDocument 404/application/errors/404.php

希望它能解决你的问题

我认为重写条件末尾的条导致了一个问题。至少它打破了对我的改写

RewriteCond $1 !^(index\.php|images|css|public|)
试着把这个条去掉

RewriteCond $1 !^(index\.php|images|css|public)
基本url应仅为“”


重新启动发动机
1美元^(index\.php | other | directory | you | want | accessible | robots\.txt)
重写规则^(.*)$index.php/$1[L]

他甚至不需要这一行,因为上面的两个条件将对其进行排序。