0
votes

http://codeigniter.com/user_guide/general/urls.html
I am using a MAMP setup I access my codeigniter welcome message as follows

http://localhost:8888/CodeIgniter_2.0.2/index.php/welcome

the tutorial says

use a .htaccess file as

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

to get same message with

http://localhost:8888/CodeIgniter_2.0.2/welcome

but I get a 404 not found error instead

4
Are you using Apache ? Also mention your OS. - Vamsi Krishna B
There's so many of these questions on SO and CI Forums, CI's docs say it's simple but so many people have followed the instructions to the T and have had problems - Doug Molineux

4 Answers

0
votes

Try to add RewriteBase on your htacces file.

RewriteEngine On
RewriteBase "/CodeIgniter_2.0.2/"
...your rules here...
0
votes

the last line should be

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

and not

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

0
votes

First things first, you need to check your httpd.conf
Look for this line.. (the location may not be the same)

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Make sure it's uncommented. Then save your changes and restart apache server.

Also, make sure that the .htaccess file is in the same directory as your index.php.
It's usually the base directory of your CodeIgniter application.

EDIT:

Also forgot to mention that you need virtual hosts for this work seamlessly.
Argh, it seems your question is a repost. Here's another question but this is on a MAC OS X platform, with some detail on setting up your virtual hosts.
Remove "index.php" from URL - Codeigniter

0
votes

the instructions you followed assume you are installing code igniter in the docroot, and not a subdirectory. move all your files in /CodeIgniter_2.0.2 down a directory.

mv CodeIgniter_2.0.2/* .