Welcome Guest, Not a member yet? Register   Sign In
Default controller doesn't work on the live site?
#1

[eluser]SkippyFiRe[/eluser]
Hi boys and girls,

I'm just diving into PHP development again, and I'm dipping into codeigniter again too. Everything is going great so far with the site I'm developing, but I hit one snag when I tried uploading everything to my hosting.

The default controller doesn't work! I get the 404 page if I try and hit my base URL. Funny thing though, I can access the default controller by name:

http://mywebsite.com/sub/ <- doesn't work!
http://mywebsite.com/sub/Home <- works! (default controller)
http://mywebsite.com/sub/SomeOtherController <- works!

Weird huh? The error message in the logs says this:

Quote:ERROR - 2010-01-16 17:56:31 --&gt; 404 Page Not Found --&gt; home

Here is what I've done so far with my configuration:

Set the base URL to my correct base URL (I am using a sub folder, and may change it to a subdomain eventually)
Set the index_page to ""
URI protocol is AUTO
default controller in the routes.php file is the name of my controller
Set my .htaccess as folows:

Code:
RewriteEngine on

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



Any ideas??? Thanks in advance!
#2

[eluser]WebsiteDuck[/eluser]
It may be a problem with windows being case insensitive and your hosting being case sensitive. Try setting your default controller in routes.php to Home with a capital H
#3

[eluser]jedd[/eluser]
[quote author="SkippyFiRe" date="1263705198"]
Everything is going great so far with the site I'm developing, but I hit one snag when I tried uploading everything to my hosting.


. . .
Any ideas???
[/quote]

Apart from using less question marks - did you work through the [url="/wiki/FAQ"]stuff in the FAQ[/url] about migrating between environments?
#4

[eluser]SkippyFiRe[/eluser]
Thanks for the replies guys, but...

I checked the case of the controller file, and class name and they are both "Home", which matches my default route.

Other than that, the versions of PHP are almost the same: 5.3 locally, and 5.2 on my hosting. I don't think I'm doing anything that advanced anyway. And since I can load the controller directly, it is probably not my code.

mod_rewrite is available and working. Like I said mywebsite.com/Home works fine with no "index.php".

I tried all 5 URI Protocols and none of them fixed the default route. Although some of them break the /Home route, I assume this is the way it is supposed to work.

Also, I tried using a subdomain, and it still doesn't work. So now my base URL is http://app.website.com/ and the code is still in a subdirectory of my site.

Any other ideas??????
#5

[eluser]SkippyFiRe[/eluser]
Wait! I fixed it!

It was something to do with case sensitivity on my (Linux) hosting. I changed the default route, file name, and the class name (and constructor name) all to lower case "home" and it works now!

So issue resolved, but do we know why it works that way???????????????????????????
#6

[eluser]jedd[/eluser]
[quote author="SkippyFiRe" date="1263773514"]
So issue resolved, but do we know why it works that way???????????????????????????
[/quote]

Yes, yes we do.

And no matter how many question marks you use, you don't appear any better at reading instructions.


From the FAQ in the wiki that I pointed you at - and which in turn paraphrases the user guide:
Quote:Consult the user guide for specifics, but briefly - Model classes should be a capitalised (first character only) with file names entirely lower case. Library classes are capitalised (first character only) with file names capitalised similarly. Core class extensions start with MY_ (unless you’ve changed the prefix in config.php) for both filename and class name.

So when you said this:
[quote author="SkippyFiRe" date="1263773256"]
I checked the case of the controller file, and class name and they are both "Home", which matches my default route.
[/quote]
- you revealed that you thought the controller filename being 'Home' was the right thing to do - despite the user guide and FAQ telling you it wasn't.

And when you said this:
Quote:It was something to do with case sensitivity on my (Linux) hosting. I changed the default route, file name, and the class name (and constructor name) all to lower case "home" and it works now!
- you revealed that you have now learned something.
#7

[eluser]SkippyFiRe[/eluser]
Thank you?

??????????
??????????????????????
???????????????


Smile ?

but seriously, thank you.




Theme © iAndrew 2016 - Forum software by © MyBB