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

[eluser]jt`[/eluser]
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: http://12.34.56.78/ (pulls up my index page fine)
However, this does NOT: http://12.34.56.78/images/smiley.gif (404 not found)

My configuration looks like this:

/var/www/... <-- everything is contained within this folder, see below
index.php
system/
images/
js/
css/

CodeIgniter is installed in system/, so:
/var/www/system/application/

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

Thanks :cheese:

Jared
#2

[eluser]libnac[/eluser]
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 http://12.34.56.78/images/smiley.gif, 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]
</IfModule>

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

I hope this works for you
#3

[eluser]jt`[/eluser]
libnac: excellent! this works perfectly, you're a saint!




Theme © iAndrew 2016 - Forum software by © MyBB