首页 文章

将URL重写重定向规则转换为htaccess

提问于
浏览
0

我有一个静态的SPA网站,使用handlebar.js模板 . 它适用于IIS,具有以下URL重写规则,但我需要将其移动到使用.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>

1 回答

  • 0
    RewriteEngine on
    RewriteRule ^([^\/]+)\/([^\/]+)\/?\.html  /index.html?category=$1&page=$2 [L]
    

相关问题