我对 CI来说是新鲜事,对改写规则不知很多。 我从中途站找到了上门通道规则,使我能够从URL中删除指数.php。 限制使用的规则如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /siebeluigen/
#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>
但是,如果我把我的控制人员直接带在控制人员内部,那就没有工作了。 例如
如果我把我的申请控制人带走,我会把他带走。
application/controllers/application.php
然后,我可以从URL那里查阅。
http://localhost/siebeluigen/application
但是,如果我的名录结构是这样的话。
application/controllers/app/application.php
接着,我发现有ur的错误。
http://localhost/siebeluigen/app/application
but it works like this
http://localhost/siebeluigen/index.php/app/application
因此,我很相信,我应该能够作出改变,使之发挥作用。
请帮助!
<>Update>
My htaccess file was in the application folder instead of root. Moving the file to the folder were index.php is located solved the issue. I have marked the answer that is working. Thanks...