简体   繁体   中英

Converting a web.config rewrite rule to Apache format

I would like to convert this web.config

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

to .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.

The <match url="^cambiarPass/" /> line is set to apply URL rewriting only to URLs (paths) which begin with cambiarPass/ . 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 . 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. 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.

Here is the complete code.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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