【发布时间】:2018-05-24 13:18:18
【问题描述】:
我有这个 .htaccess 文件:
RewriteCond %{REQUEST_URI} !/admin/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^(.*)$ rewrite.php
如何在 web.config 文件中重写它?
【问题讨论】:
标签: php .htaccess iis web-config
我有这个 .htaccess 文件:
RewriteCond %{REQUEST_URI} !/admin/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^(.*)$ rewrite.php
如何在 web.config 文件中重写它?
【问题讨论】:
标签: php .htaccess iis web-config
试试这个
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="/admin/" ignoreCase="false" negate="true" />
<add input="{THE_REQUEST}" pattern="^[A-Z]{3,}\s([^.]+)\.php" />
</conditions>
<action type="Rewrite" url="rewrite.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
【讨论】: