0
我與您聯繫,因爲我在將Apache + PHP應用程序遷移到Azure時遇到問題。在Azure Web App中重寫策略
我使用Apache重寫模塊來讀取請求URI並將它們轉換爲正確的URL。我已將這些說明轉換爲IIS重寫規則,但我無法讓它們在Azure中運行。
的規則是:
RewriteEngine on
RewriteRule ^(zpanel\/)(.*)\.json$ $1.json.php [QSA,L]
RewriteRule ^(zpanel\/)(.*)\-process\-add$ $1_procesar.php?abm_accion=a [QSA,L]
RewriteRule ^(zpanel\/)(.*)\-process\-edit\-(.*)$ $1_procesar.php?abm_accion=m&id=$2 [QSA,L]
RewriteRule ^(zpanel\/)(.*)\-process\-delete\-(.*)$ $1_procesar.php?abm_accion=d&id=$2 [QSA,L]
RewriteRule ^(zpanel\/)(.*)\-add$ index.php?put=$1_am&abm_accion=a [QSA,L]
RewriteRule ^(zpanel\/)(.*)\-edit\-(.*)$ index.php?put=$1_am&abm_accion=m&id=$2 [QSA,L]
RewriteCond %{REQUEST_URI} !(css|js|favicon|img|php|json|icon|process|report|fonts|ckeditor)
RewriteRule ^(zpanel\/)(.*)$ index.php?put=$1 [QSA,L]
所以我他們翻譯爲:
<rewrite xdt:Transform="InsertIfMissing">
<rules xdt:Transform="InsertIfMissing">
<clear/>
<rule name="rule 1d" stopProcessing="true">
<match url="^(zpanel\/)(.*)\.json$" />
<action type="Rewrite" url="/{R:1}{R:2}.json.php" appendQueryString="true" />
</rule>
<rule name="rule 1l" stopProcessing="true">
<match url="^(zpanel\/)(.*)\-process\-add$" />
<action type="Rewrite" url="/{R:1}{R:2}_procesar.php?abm_accion=a" appendQueryString="true" />
</rule>
<rule name="rule 1x" stopProcessing="true">
<match url="^(zpanel\/)(.*)\-process\-edit\-(.*)$" />
<action type="Rewrite" url="/{R:1}{R:2}_procesar.php?abm_accion=m&id={R:3}" appendQueryString="true" />
</rule>
<rule name="rule 1U" stopProcessing="true">
<match url="^(zpanel\/)(.*)\-process\-delete\-(.*)$" />
<action type="Rewrite" url="/{R:1}{R:2}_procesar.php?abm_accion=d&id={R:3}" appendQueryString="true" />
</rule>
<rule name="rule 1S" stopProcessing="true">
<match url="^(zpanel\/)(.*)\-add$" />
<action type="Rewrite" url="/{R:1}index.php?put={R:2}_am&abm_accion=a" appendQueryString="true" />
</rule>
<rule name="rule 1V" stopProcessing="true">
<match url="^(zpanel\/)(.*)\-edit\-(.*)$" />
<action type="Rewrite" url="/{R:1}index.php?put={R:2}_am&abm_accion=m&id={R:3}" appendQueryString="true" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^(zpanel\/)(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/css|js|favicon|img|php|json|icon|process|report|fonts|ckeditor$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}index.php?q={R:2}" appendQueryString="true" />
</rule>
</rules>
但在此之後,我一直有在Azure中相同的錯誤消息。 「沒有找到您要查的資源」。
翻譯好嗎?我是否需要更改其他內容以使其適用於Azure版本的IIS? 謝謝