CodeIgniter Forums
unable to call controller from URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: unable to call controller from URL (/showthread.php?tid=54836)



unable to call controller from URL - El Forum - 09-27-2012

[eluser]yaswanthbs[/eluser]
Code:
<?php

class User extends CI_Controller {

function index() {
  $this->load->view('login');
}

function userlogin() {
  echo 'user [size=1][/size]is logged in';
}

}
?>

This is my code and I am unable to call User controller. When I am accessing like this
http://localhost/learning/User

I am getting error as Not Found
The requested URL /learning/User was not found on this server.

Please help me..



unable to call controller from URL - El Forum - 09-27-2012

[eluser]TWP Marketing[/eluser]
Try this URL:
Code:
http://localhost/learning/index.php/user
NOT capitalized, with index.php


unable to call controller from URL - El Forum - 09-27-2012

[eluser]yaswanthbs[/eluser]
Smile Thats working good. Thankyou very much. But how it works ? is there any other solution with out using index.php

once again thanks..


unable to call controller from URL - El Forum - 09-30-2012

[eluser]Bankzilla[/eluser]
You can use htaccess redirect. Why index.php is involved by default I have no clue.
In your htaccess in root

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]



unable to call controller from URL - El Forum - 10-02-2012

[eluser]yaswanthbs[/eluser]
Thankyou for your response but when I placed that code in .htaccess file and copied that place in root folder. But I am facing problem like this.

Error:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

please help me.


unable to call controller from URL - El Forum - 10-03-2012

[eluser]CroNiX[/eluser]
Does your server have mod_rewrite enabled? It needs to be in order to use rewrite rules.


unable to call controller from URL - El Forum - 10-03-2012

[eluser]CroNiX[/eluser]
[quote author="Bankzilla" date="1349062506"]You can use htaccess redirect. Why index.php is involved by default I have no clue.[/quote]
Because it will work 100% of the time with index.php, but not all servers have mod_rewrite (or allow customers to alter) so if that was the default it wouldn't work out of the box on those servers.