重定向来自旧域的特定请求

发布于 2024-10-02 11:07:48 字数 133 浏览 0 评论 0原文

我已经通过 301 重定向重定向旧域,但我注意到我收到了大量来自旧站点的某些文件和页面的请求。如何重定向这些请求以便它只加载新网站?我只想对特定文件执行此操作。

编辑:该网站位于共享托管上,但我当然可以编辑 web.config 文件。

I'm already redirecting an old domain via a 301 redirect but I've noticed that I'm getting lots of requests for certain files and pages from the old site. How can I redirect these requests so that it just loads the new site? I'd like to do this for specific files only.

Edit: The website is on shared hosting, but I can edit the web.config file of course.

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

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

发布评论

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

评论(2

冷了相思 2024-10-09 11:07:48

您必须在 IIS 中为每个文件创建一个条目。在站点根目录下的磁盘上创建路径结构,并在 IIS 的该页面上为相关文件创建重定向。您可以使用记事本和资源管理器来制作这些文件。

这是我所知道的 IIS6 中最快的手动方式。不过IIS7应该更容易。在 IIS7 中,您可以编辑应用程序主机文件。

编辑:另请参阅 ~ 哪个重定向更好 - web.config 或global.asax

编辑:另请参阅 ~ http://msdn.global.asax microsoft.com/en-us/library/ms228302.aspx

You'll have to create an entry in IIS for each file. Create the path structure on disk under the site's root and on that page in IIS create a redirect for the file in question. You can use notepad and explorer to make those files.

That's the fastest manual way I know of in IIS6. IIS7 should be easier tho. In IIS7 you could edit the application host file.

EDIT: see also ~ Which redirection is better - web.config or global.asax

EDIT: see also ~ http://msdn.microsoft.com/en-us/library/ms228302.aspx

羁绊已千年 2024-10-09 11:07:48

如果您的服务器运行 IIS 版本 7 或更高版本,您可以使用 URL 重写,它允许您在 web.config 中指定映射 http://www.iis.net/download/URLRewrite
您可以创建基于正则表达式重定向所有流量的通用规则,也可以创建重写映射来设置表。
请参阅“移动目录”部分,网址为 链接

If your server is running IIS version 7 or higher you can use URL Rewrite for that which does allow you to specify the mappings in web.config http://www.iis.net/download/URLRewrite
You can either create a generic rule that redirects all traffic based on regular expressions, or create a rewrite map to setup a table.
See the section "Moving Directories" at Link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文