首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Codeigniter - removing index.php

Codeigniter - removing index.php
EN

Stack Overflow用户
提问于 2011-08-14 22:55:15
回答 2查看 262关注 0票数 0

我下载了基于代码触发器的MyClientBase应用程序。安装后,我查看了MyClientBase的网站,但默认情况下index.php仍然在那里。我尝试使用codeigniter用户指南中的提示删除index.php,但不起作用。这个问题有什么解决方案吗?谢谢

EN

回答 2

Stack Overflow用户

发布于 2011-08-14 22:57:53

我使用以下.htaccess文件删除index.php。我不确定用户指南中指定了哪一个,但我发现它工作得很好:

代码语言:javascript
复制
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
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

#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|(.*)\.swf|images|robots\.txt|css|docs|cache)
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.
    ErrorDocument 404 /index.php
</IfModule>

还要从config.php文件中删除'index.php‘。祝好运!

票数 0
EN

Stack Overflow用户

发布于 2016-08-09 15:18:50

代码语言:javascript
复制
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)$ index.php?/$1 [L]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7057508

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档