3

我一直在互联网上爬行,其他人使用的解决方案都没有为我工作。问题是默认控制器是唯一会加载的控制器。这里有很多关于这个主题的帖子。但我已经尝试了所有这些,包括尝试所有五个设置的主要建议$config['uri_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> 

#Standard CodeIgniter Rewrite
#-------------------------------------
RewriteCond $1 !^(index\.php|resources|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] AddHandler cgi-script .pl 

尽管如此,还是没有运气。有人可以提示我正确组合 .htaccess 和 $config['uri_protocol'] 设置。那里的所有答案都各不相同。是因为服务器配置不同吗?

4

1 回答 1

2

我知道了。最后。这是我的 .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>

并且$config['uri_protocol']设置为REQUEST_URI

于 2012-06-29T18:28:46.917 回答