开发者

CodeIgniter - removing index.php

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} 开发者_Go百科^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> 

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

$config['index_page'] = "";

So my CI looks like the following

/core-1.7.3
/public_html/index.php

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


Hi I ve installed that 1.7.3 and this .htaccess worked with this URL-

/CodeIgniter_1.7.3/public_html/welcome

.htaccess->

RewriteEngine On

RewriteCond $1 !^(index\.php|resources|robots\.txt)

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L,QSA] 


Work through Avisek Chakraborty's comment and make sure you've done them all, but it sounds to me like you don't have mod_rewrite installed correctly. Make sure it is by using the following test: http://www.wallpaperama.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html

It is written for windows but you should get the idea.

If it doesn't work then install mod_rewrite and try again.


Also try to change this:

$config['uri_protocol'] = “REQUEST_URI” 


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>

The Options directive is in The Apache Docs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜