Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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 CodeIgniter仅加载默认控制器_.htaccess_Codeigniter - Fatal编程技术网

.htaccess CodeIgniter仅加载默认控制器

.htaccess CodeIgniter仅加载默认控制器,.htaccess,codeigniter,.htaccess,Codeigniter,我一直在互联网上爬行,其他人使用的解决方案都不适合我。问题是默认控制器是唯一将加载的控制器。这里有很多关于这个主题的帖子。但是我已经尝试了所有的设置,包括主要建议尝试$config['uri\u protocol']的所有五种设置。我尝试了所有五种设置,但都不起作用 我还尝试了几种不同的.htaccess设置,但这些设置都没有帮助。以下是我试过的一些。首先是他们网站上的官方CI.htaccess <IfModule mod_rewrite.c> RewriteEngine O

我一直在互联网上爬行,其他人使用的解决方案都不适合我。问题是默认控制器是唯一将加载的控制器。这里有很多关于这个主题的帖子。但是我已经尝试了所有的设置,包括主要建议尝试
$config['uri\u protocol']
的所有五种设置。我尝试了所有五种设置,但都不起作用

我还尝试了几种不同的.htaccess设置,但这些设置都没有帮助。以下是我试过的一些。首先是他们网站上的官方CI.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /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 ^(.*)$ 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.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule> 

不过,运气不好。有人能告诉我.htaccess和$config['uri_protocol']设置的正确组合吗。所有的答案都不尽相同。这是因为不同的服务器配置吗?

我知道了。最后这是我的.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /materials-library/index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/materials library/index.php/$1[L]
ErrorDocument 404/index.php
$config['uri\u protocol']
被设置为
REQUEST\u uri

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /materials-library/index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>