简体   繁体   English

将Nginx / Apache重写规则重写为IIS

[英]Rewrite Nginx/Apache Rewrite Rule to IIS

I have a rewrite rule for Apache and a Nginx version. 我对Apache和Nginx版本有重写规则。 Both should be same. 两者应该相同。

URL Rewrite rules: URL重写规则:

Apache 阿帕奇

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Nginx Nginx的

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Now I have to host my site on a IIS server. 现在,我必须将站点托管在IIS服务器上。 How do I transfer this rule. 如何转移此规则。

According to your description, I suggest you could try to use below IIS url rewrite rule: 根据您的描述,我建议您可以尝试使用以下IIS URL重写规则:

Notice: If you want to use url rewrite in the IIS, you should install the url rewrite extension in below url : https://www.iis.net/downloads/microsoft/url-rewrite 注意:如果要在IIS中使用url重写,则应在下面的url中安装url重写扩展名: https : //www.iis.net/downloads/microsoft/url-rewrite

    <rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url=".*" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php" />
    </rule>
  </rules>
</rewrite>

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

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