【问题标题】:How can I redirect links to an old home.asp file to a new index.php?如何将旧 home.asp 文件的链接重定向到新的 index.php?
【发布时间】:2012-02-29 19:30:58
【问题描述】:

我正在开发一个网站,该网站在外部网站上有很多旧的传入链接。这些链接指向 http://domain.com/home.asp

但是,当前站点是在 WordPress 中构建的,http://domain.com/ 作为 URL,index.php 在根目录中。

目前,任何指向 home.asp 的链接都将重定向到 404 Not Found。将这些链接重定向到新的index.php 的最佳方法是什么? .htaccess 是我最好的选择吗?

感谢您的阅读。

【问题讨论】:

    标签: apache .htaccess redirect


    【解决方案1】:

    在 .htaccess 中:

    RewriteEngine On
    RewriteRule ^/home.asp / [L,R=301]
    

    应该做的伎俩

    L 表示在此行之后停止重写 R=301 表示向客户端发送 MOVED PERMANENTLY 响应

    【讨论】:

    • 谢谢!我想应该是这样的,谢谢您的确认。
    猜你喜欢
    • 2015-07-16
    • 1970-01-01
    • 1970-01-01
    • 2019-11-06
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 2014-06-08
    相关资源
    最近更新 更多