• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
All my controllers load and display properly, but the headers show a 404 error

#1
[eluser]Unknown[/eluser]
I've been trying to track down why my post data isn't being passed to the controller. So, I opened up firebug and had a 404 staring at me. GET 404, and POST 404 when I try to send the post data. The page displays fine, though.

I have several controllers, and they're all acting this way except for the default controller.
I enter the URL url.com/controller to get to the page and I tried every variation I can think up welcome/controller, index/controller, index.php/controller, all to no avail.

I suspect I need to alter something in the config->router.php file, but I'm not sure what needs modified.


Also, I'm new to codeigniter, only started learning it a couple days ago, so don't be afraid to spell things out like i'm an idiot.

#2
[eluser]Unknown[/eluser]
I know I keep talking to myself and no one seems to be listening but, in case that link changes, heres the instructions from that page that I followed to make everything work:



In config.php:

Code:
$config['index_page'] = "index.php?";
$config['uri_protocol'] = "QUERY_STRING";

I've successfully implemented this on GoDaddy without using "index.php?" as the index page. This is helpful when using anchor() in the URL helper to create links. Even with htaccess removing the index.php, anchor() will still put in what you have set as an index page.

You should now be able to access everything as such:

http://yourdomain.com/index.php?controller/action/etc

Once you get to a point where you want to hide the 'index.php?' paste this into your .htaccess file:

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

You should now be able to access everything as such:

http://yourdomain.com/controller/action/etc

The .htaccess file must be in Unix LF only style. If you use Notepad or Wordpad and upload an .htaccess file in CR/LF style it won't work.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.