0

我有一个站点,其中包含几个要更改为 ASP 页面的 .html 页面。我想创建一个从每个旧 .html 页面到新 .asp 页面的 301 重定向,并且该站点位于 IIS 6 上。

我认为使用 Windows 的唯一解决方案是在 IIS 中添加所有重定向,但这很耗时,因为页面很多,而且我在共享服务器上,所以主机不会这样做。

另一个想法是让 IIS 将 .html 文件解释为 ASP,然后我可以将 ASP 标记添加到每个页面以创建重定向。只要不影响其他站点并且不需要很长时间,主机就可以这样做。这可能吗?如何?除非有更快的解决方案来添加 301 重定向,否则我自己做这项工作没有问题,只要他们做的很快。

4

3 回答 3

1
  1. 打开 IIS
  2. 选择您的网站
  3. 按右键单击鼠标按钮并单击属性
  4. 选择主目录选项卡并单击配置按钮
  5. 在应用程序映射中&如果 .html 扩展名是他们的&选择它&单击编辑按钮
  6. 在编辑对话框中在可执行文本框中添加“C:\WINNT\System32\inetsrv\asp.dll”或 asp.dll 的路径并按确定...

你完成了这个,现在你的 .html 页面将处理 asp 代码......

于 2012-11-26T10:07:20.247 回答
0

Another way to do a mass redirect using ASP classic on IIS6 is to set your 404 error page to an ASP file. That file then uses logic to redirect a .html file to the .asp equivalent. This is a very efficient and powerful way of handling redirects on II6 without having to modify server settings or configurations (well, other than just the initial custom error page).

Please note you should also set your 500 server errors to use the same ASP page. This way it can also deal with "Directory listing denied" on virtual directories and know how to redirect them (or just display a 404).

于 2013-11-28T13:38:04.687 回答
0

对于重定向,您可以使用 Javascript 之类的客户端脚本,也可以使用经典 asp 之类的服务器端脚本。但是您需要更改页面的扩展名。所以你可以在你的页面上使用这个脚本

    <script type="text/javascript">
window.location="http://yourLocation";
</script>

当您转到您的页面时,这将重定向到您在此处提到的位置。您window.location="http://www.google.com";现在可以进行测试。

于 2012-11-26T10:06:25.807 回答