4

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> 

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

Cecil
  • 1,609
  • 5
  • 21
  • 26

4 Answers4

1

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] 
Fran Verona
  • 5,438
  • 6
  • 46
  • 85
Avisek Chakraborty
  • 8,229
  • 10
  • 48
  • 76
0

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

Edward J Beckett
  • 5,061
  • 1
  • 41
  • 41
0

Also try to change this:

$config['uri_protocol'] = “REQUEST_URI” 
Conner
  • 30,144
  • 8
  • 52
  • 73
Avisek Chakraborty
  • 8,229
  • 10
  • 48
  • 76
  • Now its just giving 404 for every page. – Cecil Mar 05 '11 at 11:56
  • Can u check these things- 1. If your installation is not in the server root you will need to amend the RewriteBase line from “RewriteBase /” to “RewriteBase /folder/” 2. Make sure your apache uses the mod_rewrite module 3. Make sure apache is configured to accept needed .htaccess directives [reference- http://codeigniter.com/wiki/mod_rewrite/] – Avisek Chakraborty Mar 05 '11 at 12:12
0

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.

eyaka1
  • 385
  • 2
  • 9