im trying to upload a php script to windows iis server in php script we have a htacess file which routes all the request to index.php so we can have
site.com/something
instead of
site.com/index.php?/something
but it doesnt work on the windows server so i tried to find web.config version here is what i found
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!-- Quitar los slash '/' del final de la ruta -->
<rule name="RewriteRequestsToPublic">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Rewrite" url="/{R:0}" />
</rule>
<!-- Si el archivo o carpeta solicitado no existe, se realiza la petición a través de index.php -->
<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/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
it kinda works , but it doesn't load static files (css , js ) like if i go to
site.com/public/js/jquery.js
i get this error
HTTP Error 500.52 - URL Rewrite Module Error.
The page cannot be displayed because an internal server error has occurred.
Detailed Error Information
Module RewriteModule
Notification SendResponse
Handler StaticFile
Error Code 0x800700b7
Config Error Cannot add duplicate collection entry of type 'rule' with unique key attribute 'name' set to 'Imported Rule 1'
Config File \\?\C:\HostingSpaces\phoenarts\site.com\wwwroot\public\web.config
basically it works i need to tell it to ignore link to directory and static files files
The error implies you already have a rule declared with the name Imported Rule 1
somewhere. Try changing the name of the rule in the file indicated in the error.
If you have a web.config file in ~/public and another in the web root both files are merged for requests to your static assets. This sounds like what's happening?
You can use multiple web.configs to configure different paths like this, but you shouldnt duplicate rules between them.
You can also use <location>
elements in the root web.config to configure different paths (as an alternative to using multiple web.config files).
User contributions licensed under CC BY-SA 3.0