apache用.htaccess,轉換到IIS怎麼辦?就是改成web.config檔了。
把下面的內容存到web.config內,依據自己的需求改寫規則吧~

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
               <rule name=”rule1″ stopProcessing=”true”>
                     <match url=”^(.*)-htm-(.*)” />
                     <action type=”Rewrite” url=”{R:1}.php?{R:2}” />
                </rule>
                                <rule name=”rule2″ stopProcessing=”true”>
                    <match url=”^(.*)/show-([0-9]+)([-])?([0-9]+)?.html” />
                    <action type=”Rewrite” url=”{R:1}/show.php?itemid={R:2}&page={R:4}”  />
                </rule>
                <rule name=”rule3″ stopProcessing=”true”>
                    <match url=”^(.*)/list-([0-9]+)([-])?([0-9]+)?.html” />
                    <action type=”Rewrite” url=”{R:1}/list.php?catid={R:2}&page={R:4}”  />
                </rule>
                <rule name=”rule4″ stopProcessing=”true”>
                    <match url=”^(.*)/show/([0-9]+)/([0-9]+)?([/])?” />
                    <action type=”Rewrite” url=”{R:1}/show.php?itemid={R:2}&page={R:3}”  />
                </rule>
                <rule name=”rule5″ stopProcessing=”true”>
                    <match url=”^(.*)/list/([0-9]+)/([0-9]+)?([/])?” />
                    <action type=”Rewrite” url=”{R:1}/list.php?catid={R:2}&page={R:3}”  />
                </rule>
                <rule name=”rule6″ stopProcessing=”true”>
                    <match url=”^([a-z0-9]+).co/(.*)” />
                    <action type=”Rewrite” url=”company/index.php?homepage={R:1}&rewrite={R:2}”  />
                </rule>
                <rule name=”rule7″ stopProcessing=”true”>
                    <match url=”^(htm)/(.*)” />
                    <action type=”Rewrite” url=”index.php?rewrite={R:2}”  />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>         
</configuration>

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *