Welcome Guest, Not a member yet? Register   Sign In
404 on default controller
#1

[eluser]Rian[/eluser]
I'm running circles here, I've avoided looking at the problem for a while and then tried to fix it again but I'm just really out of luck.

http://backend.example.com/ < CI 404
http://backend.example.com/index.php < CI 404
http://backend.example.com/index.php/Main < works
http://backend.example.com/Main < works

default controller is set to "Main", I have also tried "main";

Log output based on "main" and "Main" as default controllers:
Code:
DEBUG - 2008-07-10 14:20:45 --&gt; Config Class Initialized
DEBUG - 2008-07-10 14:20:45 --&gt; Hooks Class Initialized
DEBUG - 2008-07-10 14:20:45 --&gt; URI Class Initialized
ERROR - 2008-07-10 14:20:45 --&gt; 404 Page Not Found --&gt; main
DEBUG - 2008-07-10 14:22:04 --&gt; Config Class Initialized
DEBUG - 2008-07-10 14:22:04 --&gt; Hooks Class Initialized
DEBUG - 2008-07-10 14:22:04 --&gt; URI Class Initialized
ERROR - 2008-07-10 14:22:04 --&gt; 404 Page Not Found --&gt; main

Someone PLEASE make me go "duh" and beat myself up over the stupid simple mistake I made Wink
#2

[eluser]sophistry[/eluser]
a few things...

do you have .htaccess set up? what does it look like?
what are your routes? what order are they in?
do you have a dir at your webroot called main or Main?
when you say the last example "works" what does that mean? are you sure it is calling the controller you want?

EDIT: whohoo! reached 500 posts.
#3

[eluser]developer10[/eluser]
[quote author="Rian" date="1215700924"]I'm running circles here, I've avoided looking at the problem for a while and then tried to fix it again but I'm just really out of luck.

http://backend.example.com/ < CI 404
http://backend.example.com/index.php < CI 404
http://backend.example.com/index.php/Main < works
http://backend.example.com/Main < works

default controller is set to "Main", I have also tried "main";

Log output based on "main" and "Main" as default controllers:
Code:
DEBUG - 2008-07-10 14:20:45 --&gt; Config Class Initialized
DEBUG - 2008-07-10 14:20:45 --&gt; Hooks Class Initialized
DEBUG - 2008-07-10 14:20:45 --&gt; URI Class Initialized
ERROR - 2008-07-10 14:20:45 --&gt; 404 Page Not Found --&gt; main
DEBUG - 2008-07-10 14:22:04 --&gt; Config Class Initialized
DEBUG - 2008-07-10 14:22:04 --&gt; Hooks Class Initialized
DEBUG - 2008-07-10 14:22:04 --&gt; URI Class Initialized
ERROR - 2008-07-10 14:22:04 --&gt; 404 Page Not Found --&gt; main

Someone PLEASE make me go "duh" and beat myself up over the stupid simple mistake I made Wink[/quote]


maybe you didnt set up your base URL?

in /application/config/config.php edit this line:
Quote:$config['base_url'] = "http://backend.example.com/";
#4

[eluser]Rian[/eluser]
Code:
$ cat .htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    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>

lessee:
- I don't have any routes set,
- I don't have a "main" or "Main" folder,
- the base URL is properly configured, so is the index_page variable (empty for htaccess usage)

I'm sure it's calling the controller it should simply because the site works then Wink The whole site works, everything I made works, only the default controller fails. Naturally there is a quick way to fix this, add a line in the htaccess file that redirects to /Main if nothing is entered but I'm a purist at heart and would like to fix things at their base and not solve it by bypassing it Smile

Congrats on the 500 (504 now!) posts Smile
#5

[eluser]sophistry[/eluser]
are you running multiple apps off one CI codebase?

well, i'm out of ideas... except to tell you to do a clean/new install of CI and see if you can use default route out of the box.

if you can, then there is something wrong with your CI configuration - maybe change the name of the default controller (main is not a reserved word, but maybe too common)?

if you can't get default route to work on fresh install (with your .htaccess in place) then take out .htaccess and see if it works.

if you can't get default route to work at all, then something is wrong with the server configuration and or mod_rewrite.c

cheers.




Theme © iAndrew 2016 - Forum software by © MyBB