Reputation: 1563
I have deployed my site on a VPN server. I am able to access the controller constructor, but when I am trying to call any method like mydomain/controller/method
, it is not working. However 'mydomain/controller/index' is also not working.
When I am debugging with php method function_exists('my function name')
then also it is coming up false even though that method exist in my controller.
Please help with this problem, and let me know if I have to do any config changes.
Thanks!
Upvotes: 0
Views: 9453
Reputation: 9423
You will need to navigate to http://mydomain/index.php/controller/method
... unless you specifically have a .htaccess
file in the root where index.php
is that eliminates index.php
from the URL.
If you have this .htaccess file set correctly you will be able to navigate to http://mydomain/controller/method
here is an example of an .htaccess file for codeigniter that I'm using for debugging.
php_flag display_errors on
php_value error_reporting 7
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
copy all of this text to a file called .htaccess and put it where index.php is in the codeigniter root directory.
///////////////// Edit based on more info from OP //////////////////
First test to see if the following works..
Unless you deleted it, CI provides you, by default a welcome controller (/application/controllers/welcome.php)
and a welcome view thats being called by the controller (/application/views/welcome_message.php)
.
See if these files are there and if they aren't get them from the zip file in the codeigniter framework and put it in these directories.
navigate to the config folder and open routes.php
(/application/config/routes.php)
and under reserved routes
put in $route['default_controller'] = "welcome";
if it's not already there.
In addition make sure you have the Config changed to reflect the fact that you are using the .htaccess file.
the property should be set as follows in config.php $config['index_page'] = '';
Note that if you are not using .htaccess this would be set to $config['index_page'] = 'index.php';
These instructions are in an effort to get you to see something on the page. You would change the default controller to your controller (not welcome) when you get going with the above.
Upvotes: 7