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

[eluser]jpschroeder[/eluser]
UPDATE: 3/8/2010, SEE POST #5 for updated info

Hi,

Just moved a site to production and the default_controller is not working. I've created several web apps in CI before, so and never had any such issues. I tried putting up a default install of CI 1.7.2 on the server and I'm still getting a 404. The application is entirely located in a subfolder:

http://my-cool-website.com/v3/index.php

Even with a base install, and the routes simply pointing to the default:

Code:
$route['default_controller'] = "welcome";

The weird thing is that the system still works. going to: http://my-cool-website.com/v3/index.php/welcome works. Server is running 4.4.9

Any help would be appreciated.

UPDATE: 3/8/2010, SEE POST #5 for updated info
#2

[eluser]farinspace[/eluser]
Not sure I understand you ... are you saying that:

http://my-cool-website.com/v3/ (does NOT work)
http://my-cool-website.com/v3/index.php/welcome (does work)

1) do you have a properly configured htaccess file (it is a Apache server right, not IIS)
2) are you setting your config file to remove "index.php"? ($config['index_page'] = ""Wink
3) use firebug and check where the 404 is coming from, is the request being unexpectedly routed else where?
#3

[eluser]jpschroeder[/eluser]
[quote author="farinspace" date="1267530756"]Not sure I understand you ... are you saying that:

http://my-cool-website.com/v3/ (does NOT work)
http://my-cool-website.com/v3/index.php/welcome (does work)

1) do you have a properly configured htaccess file (it is a Apache server right, not IIS)
2) are you setting your config file to remove "index.php"? ($config['index_page'] = ""Wink
3) use firebug and check where the 404 is coming from, is the request being unexpectedly routed else where?[/quote]

Yes you are correct. This does not work:

http://my-cool-website.com/v3/
http://my-cool-website.com/v3/index.php

Both return a 404 error. I checked with firebug, and its not redirecting or rerouting anything, just one request. .htaccess files aren't even being used on this server. The server is Apache.

But, CI is running apparently because this works:

http://my-cool-website.com/v3/index.php/welcome
http://my-cool-website.com/v3/index.php/myowncontroller

Those work, and my own custom controllers work fine too. For some reason its just the index file that seems to be failing.
#4

[eluser]farinspace[/eluser]
From my understanding you will need the htaccess file to route nice URLs and have CI handle them properly ... without an htaccess file all urls will need to have "index.php" in them ...
#5

[eluser]jpschroeder[/eluser]
Yeah...thats just not the issue. I'm pretty familiar with the .htaccess and routing. I'm not having an issue with routing, only the default_controller routing. You don't need to modify your .htaccess file to make that work.
#6

[eluser]jpschroeder[/eluser]
Ok, here is a little more info, hopefully someone can still help me with this. I've enabled .htaccess to remove the index.php (previous posts had no .htaccess), and here is the latest:
Code:
http://somewebsite.com/v3
http://somewebsite.com/v3/
http://somewebsite.com/v3/index.php

Those do not not work, no matter what I do, they just gives a CI 404 error. However:

Code:
http://somewebsite.com/v3/index.php/
http://somewebsite.com/v3/index.php/welcome
http://somewebsite.com/v3/welcome

these all work properly. However, I want index.php to work by itself! Here is the current .htaccess file:

Code:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|uploads|favicon\.ico|robots\.txt)
    RewriteRule ^(.*)$ /v3/index.php?/$1 [L]
</IfModule>

And here are the relevant config file settings:

Code:
$config['base_url']= "http://somewebsite.com/v3/";

$config['index_page'] = "";

here is the default route:
Code:
$route['default_controller'] = "welcome";
#7

[eluser]InsiteFX[/eluser]
Did you setup your paths to system and application folders in index.php?

Enjoy
InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB