Welcome Guest, Not a member yet? Register   Sign In
unable to call controller from URL
#1

[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..
#2

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

[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..
#4

[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]
#5

[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.
#6

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

[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.




Theme © iAndrew 2016 - Forum software by © MyBB