簡體   English   中英

IIS重寫更改文件名

[英]IIS rewrite change filename

我在論壇應用程序中有一些舊URL指向http://mydomain.tld/showthread.php?p=xxxx ,其中xxxx是整數ID。

我的新論壇應用程序使用viewtopic.php?p=xxxx ,我想使用IIS web.config重寫規則來處理此問題。

我試圖添加最后一條規則如下:

<rewrite>
            <rules>
                <rule name="Redirect www to non www" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Redirect" url="http://domain.tld/{R:1}" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^domain\.tld" negate="true" />
                    </conditions>
                </rule>

                <!-- this for change from showthread.php to viewtopic.php -->
                <rule name="Rewrite" stopProcessing="true">
                    <match url="(.*)showthread\.php" />
                    <action type="Rewrite" url="viewtopic\.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>

但是,它不能重定向到viewtopic.php 有什么建議嗎?

我必須在IIS中啟用httpRedirect 然后,在論壇根目錄的web.config中使用了此重定向規則:

<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
         <add wildcard="*showthread.php" destination="/viewtopic.php?$P" />
</httpRedirect>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM