ISAPI 重写 301 重定向映射文件不起作用

发布于 2024-11-28 04:17:56 字数 727 浏览 10 评论 0原文

我有 10K 的重定向用于重新设计一个大型的新网站,但我无法将它们粘贴到 ISAPI 编辑器中 - 当我单击“应用”时它就会死掉,并且我得到一个无响应的程序,Windows 将其关闭。它们通常是 301 旧网址到新网址(就像这样)

RewriteRule ^models/308.htm$ /peugeot-308/ [R=301,L] 
RewriteRule ^models/4007.htm$ /peugeot-4007/ [R=301,L] 

我正在尝试将其作为映射文件选项,但它没有获取 txt 文件中的任何 301 重定向?这就是我所拥有的

RewriteEngine on  
RewriteBase /  
RewriteMap mapfilemodels txt:D:\websites\Production\sitename\htdocs\modelredirects.txt 
RewriteRule ^/(.*) ${mapfilemodels:$1} [R=301,L]

,在我的文本文件中我有以下旧网址和新网址?

m/alfa-romeo-page.htm /alfa-romeo/ 
m/ford-page.htm /ford/ 
models/308.htm /peugeot-308/ 
models/301.htm /peugeot-301/ 

知道为什么这不起作用吗?或者任何其他想法如何让这些到位

I have 10K of redirects for a large new site redesign and I cannot paste them in the ISAPI editor - It just dies when I click 'Apply' and I get a non responsive program and windows closes it. They are usual 301 old url to new (Like this)

RewriteRule ^models/308.htm$ /peugeot-308/ [R=301,L] 
RewriteRule ^models/4007.htm$ /peugeot-4007/ [R=301,L] 

I am trying this as a mapfile option but its not picking up any of the 301 redirects in the txt file? This is what I have

RewriteEngine on  
RewriteBase /  
RewriteMap mapfilemodels txt:D:\websites\Production\sitename\htdocs\modelredirects.txt 
RewriteRule ^/(.*) ${mapfilemodels:$1} [R=301,L]

And in my text file I have the following old urls and new urls?

m/alfa-romeo-page.htm /alfa-romeo/ 
m/ford-page.htm /ford/ 
models/308.htm /peugeot-308/ 
models/301.htm /peugeot-301/ 

Any idea why this isn't working? Or any other idea how I can get these in place

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终陌 2024-12-05 04:17:56

可以尝试的几个想法:

1. 在声明重写地图文件的绝对路径时,使用 / 而不是 \。老实说,这应该可以以任何方式工作..但是,至少,这是在 ISAPI_Rewrite 示例中完成的。

2. 我认为这种模式有点错误^/(.*)——我认为这里不需要前导斜杠。

考虑到上述所有内容,请尝试以下操作:

RewriteEngine on  
RewriteBase /  
RewriteMap mapfilemodels txt:D:/websites/Production/sitename/htdocs/modelredirects.txt 
RewriteRule ^(.*) ${mapfilemodels:$1} [R=301,L]

Few ideas to try:

1. Use / instead of \ when declaring absolute path to rewrite map file. TBH this should work either way .. but, at least, this is how it is done in ISAPI_Rewrite examples.

2. I think this pattern is a bit wrong ^/(.*) -- I do not think you need leading slash here.

Considering all aforementioned, try this:

RewriteEngine on  
RewriteBase /  
RewriteMap mapfilemodels txt:D:/websites/Production/sitename/htdocs/modelredirects.txt 
RewriteRule ^(.*) ${mapfilemodels:$1} [R=301,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文