简体   繁体   中英

When hosting Codeigniter 3 Application on iis 8.5 server only loading default Controller index function

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM