【问题标题】:Redirect files from on server to another server将服务器上的文件重定向到另一台服务器
【发布时间】:2015-07-07 11:51:37
【问题描述】:

我需要将所有文件从一台服务器重定向到另一台服务器

例如

www.example.com/file.php 至 www.example2.com/files/file.php

RedirectPermanent /file.php http://example2.com/files/file.php 

效果很好。如何用它重定向多个文件?

感谢您的帮助!

【问题讨论】:

  • 那么,您想让旧域上的所有链接指向一个新域吗?

标签: php apache .htaccess mod-rewrite


【解决方案1】:

要将多个文件从一台服务器重定向到另一台服务器,您需要使用带有正则表达式模式的 RedirectMatch 指令。

在你的 example1.com/.htaccess 中试试这个:

 RedirectMatch 301 ^/(.*)$ http://example2.com/files/$1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-11-05
    • 2012-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-23
    相关资源
    最近更新 更多