1

I migrated a site form a php system to Umbraco. I would like to redirect all the old urls (es: index.php? ...) to the current site root, so I wrote a rule:

<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
    <rewrites>        
        <add name="301RedirectDirUrlsOldSite" virtualUrl="^http\://www.mysite.it/index.php(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.mysite.it/" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    </rewrites>
</urlrewritingnet> 

The rule works fine but the redirect incluse also the querystring parameters. For example is I fire www.mysite.it/index.php?p=10&url=test I've been redirect to the same url (without 404) but not to www.mysite.it only as I expect. Is there anything to change over my rule?

4

1 回答 1

2

在 Umbraco 中进行 php 重写时,我使用以下内容,这应该适合您:

<add name="phpRewrites" virtualUrl="^~/(.*)\.php(.*)" rewriteUrlParameter="IncludeQueryStringForRewrite" redirect="Application" redirectMode="Permanent" destinationUrl="~/" ignoreCase="true" />

virtualUrl 和 destinationUrl 的区别可能看起来微不足道 - 但试一试。

于 2014-09-17T11:24:33.063 回答