0

I created a web site and hosted in an IIS server, but there I cannot access my site's inner links.

For example: http://example.com/about where 'about' is the controller.

Here http://example.com is working well, but http://example.com/about returns a 404 error.

Tiffany
  • 609
  • 12
  • 26
  • Did you've removed **index.php** via `htaccess`? Try `http://example.com/index.php/about` – Aksen P Dec 17 '19 at 13:33
  • you need to look at your .htaccess file – Devsi Odedra Dec 17 '19 at 13:34
  • Check security group permissions on the subfolder, see https://stackoverflow.com/questions/14934006/iis-iusrs-and-iusr-permissions-in-iis8 – Tiffany Dec 17 '19 at 13:34
  • 1
    For the commenters stating to use .htaccess: IIS doesn't use .htaccess, .htaccess is for Apache web servers. – Tiffany Dec 17 '19 at 13:35
  • @OP also check your IIS error log, see https://stackoverflow.com/questions/6426375/where-can-i-find-the-iis-logs to find out where your log file should be. The path to your log file must be configured in IIS. – Tiffany Dec 17 '19 at 13:55
  • 404 is showing while giving link http://example.com/about – Muhammed Athil Dec 17 '19 at 14:13
  • Have you verified the correct security groups are set on the `about` folder? Windows/IIS can behave a bit weird with permissioning, like subdirectories or files having different security groups than their parent folder. Or sometimes even a program will change the security groups, depending on how the program saves a file, which is what I've experienced with phpstorm at one time. – Tiffany Dec 17 '19 at 15:21
  • 'about' is not a folder it is one controller file – Muhammed Athil Dec 17 '19 at 15:34
  • So either you need to turn on PHP error reporting and debug the error you receive, or check the IIS error log. – Tiffany Dec 17 '19 at 16:06

1 Answers1

1

As far as I know, if you want to hosted the Codeigniter in the IIS, you need to add some special url rewrite rule to let your application work well.

I suggest you could install the url rewrite extension for the IIS firstly.

Then I suggest you could try to add below rule into the web.config.

  <system.webServer>

    <rewrite>

      <rules>

          <rule name="Index">

          <match url="^(.*)$" />

          <conditions>

            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />

          </conditions>

                <action type="Rewrite" url="index.php/{R:1}" />

        </rule>

      </rules>

    </rewrite>

  </system.webServer>

Brando Zhang
  • 15,923
  • 6
  • 23
  • 48