Welcome Guest, Not a member yet? Register   Sign In
Default Controller not working
#1

[eluser]Marcelo Reborn[/eluser]
Hello,

My default Controller works locally, on my PC (Windows), but not on it's (Linux) server.

In config/routes.php I did set it to "Login", which is a existing class, named as Login.php, but even trying with another classes names, it doesn't works.
Code:
$route['default_controller'] = "Login";

In config/config.php I did set base url correctly:
Code:
$config['base_url'] = "http://mypage.com/projetos/aquarelaFilmes/";


Accessing http://mypage.com/projetos/aquarelaFilmes/ results in:
Code:
404 Page Not Found

The page you requested was not found.


But, it works if I try http://mypage.com/projetos/aquarelaFilme....php/Login


Is there any way that I can debug (using echo or something else) what is the class/url it's trying to load? Maybe then I can discover what is happening.


Happy new year!
Thanks in advance
#2

[eluser]Mike DeFelice[/eluser]
If it is not working without the index.php then you need to modify your .htaccess

User Guide

Hope this helps!
#3

[eluser]Marcelo Reborn[/eluser]
[quote author="Mike DeFelice" date="1294003906"]If it is not working without the index.php then you need to modify your .htaccess
[/quote]

It's not working with or without the index.php. Only works when I access the class.

Working:
http://mypage.com/projetos/aquarelaFilmes/index.php/Login

Not working (it's the same...):
http://mypage.com/projetos/aquarelaFilmes/
http://mypage.com/projetos/aquarelaFilmes/index.php
#4

[eluser]Mike DeFelice[/eluser]
I'm sorry about that, I didn't understand the initial problem. In your config.php file you change

$config['log_threshold'] = 4;

then in your log files (system/logs) it should show you which controller it tried accessing
#5

[eluser]Marcelo Reborn[/eluser]
Thanks, Mike!

Now I had some advance!

Code:
ERROR - 2011-01-02 14:28:22 --> 404 Page Not Found --> login

It's trying to load "login", but I set to load "Login"!
I think CI is "uncapitalizing" controller's name.

Now I have to uncapitalize all my controller filenames and urls references.
#6

[eluser]Mike DeFelice[/eluser]
Great! I am glad I could help!
#7

[eluser]Atharva[/eluser]
[quote author="Marcelo Reborn" date="1294007767"]Thanks, Mike!

Now I had some advance!

Code:
ERROR - 2011-01-02 14:28:22 --> 404 Page Not Found --> login

It's trying to load "login", but I set to load "Login"!
I think CI is "uncapitalizing" controller's name.

Now I have to uncapitalize all my controller filenames and urls references.[/quote]


The issue is not with CI but Linux. You will need to have filename starting with small on linux servers.
#8

[eluser]Marcelo Reborn[/eluser]
[quote author="Atharva" date="1294009279"]
The issue is not with CI but Linux. You will need to have filename starting with small on linux servers.[/quote]

CI was uncapitalizing a string with "Login" value, set as default controller value.
Wasn't a Linux issue, because everything was working fine.

I had a file named Login.php, which as working fine through "www.page.com/Login/function".
If the default controller was called correctly by CI, it would be working fine too.
#9

[eluser]InsiteFX[/eluser]
I guess you still have not read the CodeIGniter User Guide!

CodeIgniter User Guide - Controllers

Let's create a simple controller so you can see it in action. Using your text editor,
create a file called blog.php, and put the following code in it:
As you see above the filename is saved as all lowercase!

Note: Class names must start with an uppercase letter. In other words, this is valid:

Code:
<?php
class Blog extends Controller {

}
?>

This is not valid:
Code:
<?php
class blog extends Controller {

}
?>

InsiteFX
#10

[eluser]Marcelo Reborn[/eluser]
InsideFX,

I thank you, but, did you read all posts? My problem is already solved!

And, by the way, I just made that mistake because in another topic I've created, I got confused with your post, which wrote about Library, when I was asking about controller classes.

I'm going to read all the user guide ten times today, ok? :roll:




Theme © iAndrew 2016 - Forum software by © MyBB