CodeIgniter Forums
Codeigniter 3 not working on iis - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Codeigniter 3 not working on iis (/showthread.php?tid=74216)



Codeigniter 3 not working on iis - tp45 - 08-28-2019

Hello
am trying to run my website on iis but it only run the first page my is like this url http://localhost/friendmiiDemo/ and it works but when i go to http://localhost/friendmiiDemo/about it does not work i get this error https://www.dropbox.com/s/omltzinfskxpbey/Screenshot%20(49).png?dl=0 1


this is my web.config
Code:
<?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="{R:1}" pattern="^(index\.php|assets|images|js|css|uploads|favicon.png)" ignoreCase="false" />
                        <add input="%(REQUEST_FILENAME)" matchType="IsFile" />
                        <add input="%(REQUEST_FILENAME)" matchType="IsDirectory" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


the first loaded page https://www.dropbox.com/s/qk38l9uoh5qvv1q/Screenshot%20(48).png?dl=0

and in the config i have these routes

PHP Code:
$route['posts/create'] = 'posts/create';
$route['posts/update'] = 'posts/update';
$route['posts/(:any)'] = 'posts/view/$1';
$route['posts'] = 'posts/index';
$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE
i really don’t know what is wrong
my navbar code below
Code:
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <a class="navbar-brand" href="<?php echo base_url(); ?>">FriendMii</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav">
      <li class="nav-item active">
        <a class="nav-link" href="<?php echo base_url(); ?>">Home</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="<?php echo base_url(); ?>about">About</a>
      </li>
       <li class="nav-item">
        <a class="nav-link" href="<?php echo base_url(); ?>posts">Blog</a>
      </li>
    </ul>
    <ul class="nav navbar-nav navbar-right">
      <a class="nav-link" href="<?php echo base_url(); ?>posts/create">Create post</a>
    </ul>
  </div>
</nav>

Please help
Thanks in advance


RE: Codeigniter 3 not working on iis - jreklund - 08-29-2019

I have had success with the following:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
       <defaultDocument>
           <files>
               <remove value="index.htm" />
               <remove value="Default.htm" />
               <remove value="Default.asp" />
               <remove value="iisstart.htm" />
               <add value="index.php" />
           </files>
       </defaultDocument>
       <rewrite>
           <rules>
               <rule name="Remove Index.php" stopProcessing="true">
                   <match url="^(.*)$" ignoreCase="false" />
                   <conditions logicalGrouping="MatchAll">
                       <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                       <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                       <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                   </conditions>
                   <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
               </rule>
           </rules>
       </rewrite>
   </system.webServer>
</configuration>



RE: Codeigniter 3 not working on iis - tp45 - 08-29-2019

Thanks @jreklund it does not give me the error any more.. now it says (No input file specified.)
iis is stressing, i will keep trying to fix it but if you have any solution or an advice please help.


RE: Codeigniter 3 not working on iis - jreklund - 08-30-2019

I would check IIS error and access logs to find some more clues, that's a pretty generic error.

It can be miss-configured PHP Handler, read/write permissions on files etc.


RE: Codeigniter 3 not working on iis - InsiteFX - 08-31-2019

Note that a route with (:any) in it needs to be the very last route,
it is a catch all route.


RE: Codeigniter 3 not working on iis - tp45 - 08-31-2019

Good news it works i changed this <action type="Rewrite" url="index.php/{R:1}" appendQueryString="false" />
To this <action type="Rewrite" url="index.php?/{R:1}" appendQueryString="false" />


RE: Codeigniter 3 not working on iis - tp45 - 08-31-2019

and i fount this link with some solutions for this problem https://github.com/EllisLab/CodeIgniter/wiki/Godaddy-Installation-Tips


RE: Codeigniter 3 not working on iis - jreklund - 09-01-2019

GoDaddy strikes again it seems. Don't know why they are using that idiotic structure on their servers.