maybe you can help me out here. I have an issue with my codeigniter setup. It’s a fresh install and all I’ve done is this to the welcome controller:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$this->load->view('welcome_message');
}
function test()
{
echo "test";
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
other than that, everything is out of the box. Here is my .htaccess file that I am using:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteEngine on
RewriteCond %{QUERY_STRING} callback
RewriteRule (.*) /$1? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
Can’t remember where I got this from, but it’s working on other versions of codeigniter. so right now, when I got to this url:
http://myurl.com/welcome/index
the pages comes up fine, but when I got to this url, I get:
I get page not found. For some reason it seems that I need to load a view file for the page to be found. I’ve done multiple ci installations, and this is the first time I’ve had so many issues.
The reason why I need echo to work like this is because I use it to spit out lots of information using print_r, so I don’t always use a controller. I have another problem with this installation, but that’s for another question.
thanks guys!
Update
What’s really odd about this issue is that this doesn’t happen in firefox, but it happens in ie and chrome. I’ve never seen anything like this before.
update
Unfortunately I read the error wrong… doh! When I hit the welcome/test, I get an “Oops! This link appears to be broken.”, not a 404 error. And on ie I get the
The webpage cannot be found HTTP 404
Most likely causes: •There might be a
typing error in the address. •If you
clicked on a link, it may be out of
date.
What you can try:
Retype the address.Go back to the previous page. Go to and look for the information you want. More informationThis error (HTTP 404 Not Found) means
that Internet Explorer was able to
connect to the website, but the page
you wanted was not found. It’s
possible that the webpage is
temporarily unavailable.
Alternatively, the website might have
changed or removed the webpage. For
more information about HTTP errors,
see Help.
If I try to hit a page that doesn’t exist, I get 404 errors which is what I expect.
Hey Johnathan, I’m glad I got to fix your problem. All you had to do was enable apache’s mod rewrite.
Because you didn’t have apache’s mod rewrite, code igniter must have screwed up some rewrite rules and messed up your form data on post back.