How I can modify my web.config in iis to solve a directory redirection issue?

57 views Asked by At

I am working with codeigniter over IIS 10, I have my project root in \inetpub\wwwroot\project I was trying to set up codeigniter with IIS on the same folder, after a lot of research I write this web.config file:

<configuration>
 <system.webServer>
  <rewrite>
   <rules>
    <rule name="Renombrar directorio actual" stopProcessing="false">
     <match url="^(.*)$" ignoreCase="false"/>
     <action type="Rewrite" url="public/{R:1}" appendQueryString="false"/>
    </rule>
    <rule name="Rewrite routed access to assets by extension" 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="public/index.php/{R:1}" appendQueryString="true"/>
    </rule>
   </rules>
  </rewrite>
 </system.webServer>
</configuration>

This works pretty well but I am facing this problem, when I type for example http://localhost/project/loginResources in the browser it redirects me to localhost/project/public/loginResources/ which doesn't work because that url points to localhost/project/public/public/loginResources but if I add a trailing slash in the url (example: http://localhost/project/loginResources/)it works fine. I would like to remove that annoying behaviour in my server, so what I need to modify in my web.config to access to a folder in public without that trailing slash

0

There are 0 answers