我有来自旧网站的大约12000个网址,需要重定向到新网站,相同的域名,相同的ID,但不同的文件夹。 我创建了一个静态rewriteMaps.config文件,这是我的旧网址和新网址的示例
<rewriteMaps>
<rewriteMap name="Redirects">
<add key="/4935/apple-iphone-event-what-to-expect" value="/Node/d/4946" />
<add key="/4936/twitter-tablet-android-app-details-leaked" value="/Node/d/4947" />
<add key="/4937/samsung-ativ-q-not-launching-this-year" value="/Node/d/4948" />
<add key="/4938/amazon-smartphone-3d-screen" value="/Node/d/4949" />
<add key="/4939/Newkia-a-Nokia-on-Android" value="/Node/d/4950" />
<add key="/4940/Nexus-5-first-proper-leaks-based-render-looks-exciting" value="/Node/d/4951" />
<add key="/4941/survey-iphone-5s-5c-upgrade" value="/Node/d/4952" />
<add key="/4942/ipad-ipad-mini-leak-alleged-tablet-shell" value="/Node/d/4953" />
<add key="/4943/redesigned-google-logo-found-in-chrome-for-android-beta" value="/Node/d/4954" />
<add key="/4944/Amazon-says-no-smartphone-this-year-no-free-phone-ever" value="/Node/d/4955" />
</rewriteMap>
</rewriteMaps>
我的web.config文件
<rewrite>
<rewriteMaps configSource="rewriteMaps.config" />
<rules>
<rule name="Redirect old website urls">
<match url=".*" />
<conditions>
<add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
文件大小变为2 MB,超过12000 url,我问这个案例是否有重定向条件匹配!
答案 0 :(得分:1)
您需要使用此规则,而不是#34;重定向旧网站网址&#34;,如果所有旧网址都是从4位数开始
TypeError: Error when calling the metaclass bases
function() argument 1 must be code, not str