I'm setting up a new codeigniter 3 application on IIS 8.5 Server. while loading default controller and index function working fine but after calling any other function it just reloading default controller index function.
This is my Web Config file
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true" />
<rewrite>
<rules>
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<add value="index.php"/>
</files>
</defaultDocument>
<handlers>
<add name="PHP-phtml" path="*.phtml" verb="*" modules="CgiModule" scriptProcessor="C:\Program Files (x86)\Plesk\Additional\PleskPHP70\php-cgi.exe" resourceType="File" />
<add name="PHP-php3" path="*.php3" verb="*" modules="CgiModule" scriptProcessor="C:\Program Files (x86)\Plesk\Additional\PleskPHP70\php-cgi.exe" resourceType="File" />
<add name="PHP-php" path="*.php" verb="*" modules="CgiModule" scriptProcessor="C:\Program Files (x86)\Plesk\Additional\PleskPHP70\php-cgi.exe" resourceType="File" />
</handlers>
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
Controller
class Login extends CI_Controller {
public function index() {
$this->load->view('employee_login');
}
public function emp_login_check() {
print_r("hello");
}
}
Login is my default controller. The employee_login page loading fine and from employee_login page when i try to call emp_login_check, it's just reloading employee_login page again.
employee_login page
<html>
<form class="m-t" role="form" action="<?php echo base_url('Login/emp_login_check'); ?>" method="post">
<button type="submit">Login</button>
</form>
</html>
Can any help me, why is not calling emp_login_check function? Iam new to iis server.
You need to check what is your site bindings and site configuration settings.
site bindings:
controller: Login.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Login extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper('url');
}
public function index()
{
$this->load->view('employee_login');
}
public function emp_login_check()
{
print_r("hello");
exit;
}
}
View: employee_login.php
<html>
<form class="m-t" role="form" action="<?php echo base_url('Login/emp_login_check'); ?>" method="post">
<button type="submit">Login</button>
</form>
</html>
Config.php:
$config['base_url'] = 'http://localhost:8066/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
URL rewrite rule:
<rule name="RuleRemoveIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.