【问题标题】:Convert URL Rewrite redirect rule to htaccess将 URL 重写重定向规则转换为 htaccess
【发布时间】:2015-11-17 22:29:40
【问题描述】:

我有一个使用 handlebar.js 模板的静态 SPA 类网站。它适用于具有以下 URL 重写规则的 IIS,但我需要将其移动到使用 .htaccess 的服务器。我不确定如何将以下 URL 重写规则转换为 .htaccess 重写规则:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                <match url="^([^/]+)/([^/]+).html" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.html?category={R:1}&amp;page={R:2}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

【问题讨论】:

    标签: apache .htaccess mod-rewrite url-rewriting


    【解决方案1】:
    RewriteEngine on
    RewriteRule ^([^\/]+)\/([^\/]+)\/?\.html  /index.html?category=$1&page=$2 [L]
    

    【讨论】:

      猜你喜欢
      • 2013-08-27
      • 1970-01-01
      • 1970-01-01
      • 2014-06-30
      • 2016-08-09
      • 2018-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多