• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Following tutorial and getting a 404 when accessing controllers

#4
I have had what I think is the same problem when following the tutorial. The problem is that when the function site_url() is used to get the first part of a link, it does correctly get "localhost/index.php" and adding "/news/create" (for example) completes the link. And as stated in the initial question, following that link gets a 404 error.

I played around a bit, and found that while in the source, a the link will indeed show "localhost/index.php/news/create", but hovering over the link in the browser shows that the server (apache in my case) expects to go to  "localhost/index.php/localhost/index.php/news/create". And indeed the 404 page does say it can't find that page.

I haven't quite worked out if adjustments need to be made in the web server configs of codeigniter. If some one could give a hint that would be good.

Further info that maybe helpful. I got things going by not using the site_url function, instead giving an absolute reference. So for the example I give my href is "/index.php/news/create". Works every time.

My setup is straight out of the box, with

$config['base_url'] = 'localhost/';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'REQUEST_URI';

Hopes this helps. And any suggestions about why things actually work for me wuld be greatly appreciated.
Reply


Messages In This Thread
RE: Following tutorial and getting a 404 when accessing controllers - by chrisknew - 02-14-2019, 06:27 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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