简体   繁体   中英

Codeigniter, URL Routing is failing

With a codeigniter codebase I've inherited, I'm attempting to get url routing up and running but it only seems to throw 404 errors.

When I go to http://root_url/index.php it hits the default controller/method just fine, however when I request any specifically controller/action, it 404s.

If I request http://root_url/index.php/auth/login apache throws

File does not exist: /var/www/ci_project/index.php/auth/login, referer: http://root_url/index.php

It looks like apache is trying to request a folder that obviously doesn't exist instead of supplying the uri segments of auth/login to the index.php

Notes:

  • I'm not using any htaccess file(the codebase should work without one)
  • mod_rewrite is enabled and is detected by php though I suspect the problem is occuring before hitting php
  • I'm using debian(w/ apache 2.2.2) as opposed to ubuntu(2.2.14) where it does work
  • Query string arguments work fine, it's just the URI segments
  • I'm not attempting to remove index.php, just get the basic controller url matching working

It actually turned out to be an apache configuration issue on debian and nothing particularly to do with codeigniter at all.

I did a purge/re-install of apache and that appeared to fix the issue.

sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge
sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5

My only guess as to why the problem occured is that I had the libapache2-mod-php5filter (which I didn't realise till purging occured) instead of the libapache2-mod-php5 package installed and it simply didn't handle the urls correctly.

Thanks for the help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM