如何将此.htaccess转换为IIS web.config?
将这些行转换为IIS web.config的正确方法是什么?我正在尝试使用支持历史的主干路由器。它与.htaccess完美结合,但我不知道如何在IIS上实现这一点 .htaccess文件如何将此.htaccess转换为IIS web.config?,.htaccess,iis,backbone.js,history,web-config,.htaccess,Iis,Backbone.js,History,Web Config,将这些行转换为IIS web.config的正确方法是什么?我正在尝试使用支持历史的主干路由器。它与.htaccess完美结合,但我不知道如何在IIS上实现这一点 .htaccess文件 # html5 pushstate (history) support: <ifModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_F
# html5 pushstate (history) support:
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
</ifModule>
经过一些挖掘,这段代码对我来说可以在IIS上运行。转换htaccess时我正在查看。我希望它能帮助其他寻求这种解决方案的人
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="history" 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" />
<add input="{URL}" pattern="^index$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.html" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<remove value="index.html" />
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
这与主干网有什么关系?Htaccess会将任何路径重定向到index.html。然后index.html中的主干路由器读取这些路径。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="history" 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" />
<add input="{URL}" pattern="^index$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.html" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<remove value="index.html" />
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>