0

I did what it is said in the htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I put the above, so that I will be able to do this:

http://localhost/Speakom2/Home/index

Instead of:

http://localhost/Speakom2/index.php/Home/index

But it doesnt work... I get 404 error..how to fix this so it works?!?

Controller:

class Home extends CI_Controller {

public function Index() 
{
    $this->load->view('welcome_message');
}

}

htaccess:

  RewriteEngine on
   RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
Dmitry Makovetskiyd
  • 6,942
  • 32
  • 100
  • 160
  • possible duplicate of [CodeIgniter htaccess subfolder problem](http://stackoverflow.com/questions/7527491/codeigniter-htaccess-subfolder-problem) – Ben Apr 13 '12 at 07:08

4 Answers4

1

when you are running on the local host your web root is /localhost/mysite/ but in the real host your root is /mysite : so in localhost use :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L] 

note that index.php without /

amd
  • 20,637
  • 6
  • 49
  • 67
1

Make sure that your .htaccess file is in Speakom2 folder (Codeigniter root directory). And change to this

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
safarov
  • 7,793
  • 2
  • 36
  • 52
0
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]   
Ryan
  • 14,392
  • 8
  • 62
  • 102
0

//this is .htaccess file just replace it 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]

Ravi Jethva
  • 1,931
  • 2
  • 11
  • 12