Welcome Guest, Not a member yet? Register   Sign In
Mod Rewrite not working for me

Hello, I've done all of the steps listed on the CI Wiki (http://codeigniter.com/wiki/mod_rewrite/) and I'm successfully able to pull up the default controller and view by simply typing in the server IP address.

So, this works: (pulls up my index page fine)
However, this does NOT: (404 not found)

My configuration looks like this:

/var/www/... <-- everything is contained within this folder, see below

CodeIgniter is installed in system/, so:

Any idea why I can't open smiley.gif from the images/ folder when typing in ?

Thanks :cheese:


You can access to this file because all the requests are redirected to index.php by default and try to execute this function on your main controller class. When codeigniter receives, it try to execute function images with smiley.gif and how this function doesn't exists you can obtain this image.

This is why you must create an .htaccess file on the www directory, like this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ index.php [L]
RewriteCond $1 !^(index.php|media|img|javascript|css|robots.txt|favicon.ico|images)
RewriteRule ^(.*)$ index.php/$1 [L]

Then you can access to all the files listed between brackets.

I hope this works for you

libnac: excellent! this works perfectly, you're a saint!

Theme © iAndrew 2016 - Forum software by © MyBB