我想将.htaccess
文件转换为web.config
。
这是代码
AddType application/x-httpd-php .html
RewriteEngine on
RewriteBase /
RewriteCond %{Request_Filename} !-d
RewriteCond %{Request_Filenam}e !-f
RewriteRule ^pages/([0-9A-Za-z_\-~',]+) page_details.html?category_page_title=$1 [NC]
任何人都可以帮我将这个.htaccess文件转换为web.config文件。
提前致谢。
答案 0 :(得分:3)
关于整个.htaccess
文件的转换,请参阅本手册:http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/
它非常全面,并解释了如何转换规则。
如果您只想重写转换规则,请阅读以下文章: http://learn.iis.net/page.aspx/470/importing-apache-modrewrite-rules/
这是一个更加循序渐进的gui指南,但在你的情况下它应该足够了。
在任何情况下,您列出的规则可能会以web.config
的这一部分结束:
<rewrite>
<rules>
<rule name="page details" stopProcessing="true">
<match url="^/pages/([0-9A-Za-z_\-~',]+)" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/page_details.html?category_page_title={R:1}" />
</rule>
</rules>
</rewrite>