CodeIgniter - 删除index.php [英] CodeIgniter - removing index.php

查看:70
本文介绍了CodeIgniter - 删除index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的CI安装删除index.php事情有一些麻烦,当前.htaccess im使用如下:

Im having some trouble removing the index.php thing on my CI install, the current .htaccess im using is as follows:

<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>
ErrorDocument 404 /index.php
</IfModule> 

我的CI安装是从public_html目录返回的,我已经将配置更改为

My CI install is back from the public_html directory and i have changed the config to

$config['index_page'] = "";

所以我的CI看起来像下面的

So my CI looks like the following

/core-1.7.3
/public_html/index.php

当我键入的url我得到404,但是当我把index.php在它的前面,它工作正常:S

When i type the url i get the 404, but when i put index.php in front of it, it works fine :S

Im confused

Im confused

推荐答案

您需要为.htaccess重写...的FollowSymLinks指令...

You need the FollowSymLinks directive for .htaccess rewrites ...

Options Indexes FollowSymLinks

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

Options指令位于 Apache文档

The Options directive is in The Apache Docs

这篇关于CodeIgniter - 删除index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆