我有一个使用handlebar.js模板的静态SPA网站。它适用于IIS,具有以下URL重写规则,但我需要将其移动到使用.htaccess的服务器。我不确定如何将以下网址重写规则转换为.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}&page={R:2}" />
</rule>
</rules>
</rewrite>
</system.webServer>
答案 0 :(得分:0)
RewriteEngine on
RewriteRule ^([^\/]+)\/([^\/]+)\/?\.html /index.html?category=$1&page=$2 [L]