简体   繁体   English

将web.config重写规则转换为Apache格式

[英]Converting a web.config rewrite rule to Apache format

I would like to convert this web.config 我想转换这个web.config

<rule name="cambiarPass" stopProcessing="true">
<match url="^cambiarPass/" />
<action type="Rewrite" url="modulos/cambiarPass/controller.php" appendQueryString="false" />
</rule>

to .htaccess. .htaccess。 Please help! 请帮忙!

Bear in mind that I do not use IIS but the provided code seems pretty self-explanatory in terms of how it should be converted to an Apache rewrite rule. 请记住,我不使用IIS,但是就如何将其转换为Apache重写规则而言,所提供的代码似乎很不言自明。

The <match url="^cambiarPass/" /> line is set to apply URL rewriting only to URLs (paths) which begin with cambiarPass/ . <match url="^cambiarPass/" />行设置为仅将URL重写应用于以cambiarPass/开头的URL(路径)。 The

<action type="Rewrite" url="modulos/cambiarPass/controller.php" appendQueryString="false" />

line is the one doing the rewriting and redirecting all matched URLs to modulos/cambiarPass/controller.php . 一行是重写所有匹配的URL并将其重定向到modulos/cambiarPass/controller.php The appendQueryString attribute is obviously a synonym for the Apache QSA rewrite flag meaning the rewrite process will discard and ignore any existing query string data during the rewrite. appendQueryString属性显然是Apache QSA重写标志的同义词,这意味着重写过程将丢弃并忽略重写过程中任何现有的查询字符串数据。 The stopProcessing attribute seems to be yet another equivalent for the Apache L rewrite flag meaning if this rule is matched any additional rewrite rules that might follow the current rule will simply be ignored. stopProcessing属性似乎与Apache L重写标志等效,这意味着如果该规则匹配,则可能会遵循当前规则的任何其他重写规则都将被忽略。

Here is the complete code. 这是完整的代码。

RewriteEngine on
RewriteRule ^cambiarPass/ modulos/cambiarPass/controller.php [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM