CodeIgniter 4 - HTTP Error 404.0 - Not Found

0

I'm haven't issue getting CodeIgniter 4 to work, I have other apps running on the same web server using CI 3.x without any issues. I have PHP 7.3.17 installed with IIS via FAST_CGI.

I can see the welcome message using this uri http://dev.com/CI-4.0.3/public/. When I try http://dev.com/CI-4.0.3/pages/showme I keep getting

HTTP Error 404.0 - Not Found - The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

What am I missing? Any suggestion is greatly appreciated.

  1. I updated the $baseURL in Config/App.php to http://dev.com/CI-4.0.3/.

  2. Created a controller Pages.php with the following code:

    class Pages extends BaseController {
        public function showme($page = 'home'){
            echo 'This page is '. $page;
            echo view('templates/header');
            echo view('pages/'.$page);
            echo view('templates/footer');
        }
    }
    

In my Views folder I have a pages and templates folder with the following files:

  • Views/pages/home.php
  • Views/pages/aboutus.php
  • Views/templates/header.php
  • Views/templates/footer.php

My web.config looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite> 

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Detailed Error Information:

Module IIS Web Core

Notification MapRequestHandler

Handler StaticFile

Error Code 0x80070002

Requested URL http://dev.com:80/CI-4.0.3/index.php?url=pages/showme/home

Physical Path C:\inetpub\wwwroot\CI-4.0.3\index.php

Logon Method Anonymous

Logon User Anonymous

php
iis-express
codeigniter-4
asked on Stack Overflow Jun 8, 2020 by user752746 • edited Jun 8, 2020 by Don't Panic

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0