转换一个web.config重写规则到Apache格式
问题描述:
我想这样的web.config转换一个web.config重写规则到Apache格式
<rule name="cambiarPass" stopProcessing="true">
<match url="^cambiarPass/" />
<action type="Rewrite" url="modulos/cambiarPass/controller.php" appendQueryString="false" />
</rule>
为.htaccess转换。请帮忙!
答
请记住,我不使用IIS,但所提供的代码在应该如何转换为Apache重写规则方面看起来不言自明。
<match url="^cambiarPass/" />
行设置为仅将URL重写应用于以cambiarPass/
开头的URL(路径)。该
<action type="Rewrite" url="modulos/cambiarPass/controller.php" appendQueryString="false" />
线是一个做重写和重定向所有匹配的网址modulos/cambiarPass/controller.php
。 appendQueryString
属性显然是Apache QSA rewrite flag的同义词,这意味着重写过程将在重写期间放弃并忽略任何现有的查询字符串数据。 stopProcessing
属性似乎又是Apache L rewrite flag的另一个等价物,这意味着如果此规则匹配,则任何可能遵循当前规则的其他重写规则都将被忽略。
这里是完整的代码。
RewriteEngine on
RewriteRule ^cambiarPass/ modulos/cambiarPass/controller.php [L]