【问题标题】:Redirect 1 domain to other base on url ending根据 url 结尾将 1 个域重定向到其他域
【发布时间】:2013-07-12 09:36:02
【问题描述】:

所以我认为这真的很简单,但我很难做到。我希望它以两种方式使用[所以它的 2 个脚本]。 总是重定向 url 是 redirect.com 而 base.url 是 base.com [如果我需要,base.com 可以交换到其他 url]

1.当我输入:redirect.com/?q=search 它实际上做的是重定向到 base.com/q=search

2。当我在浏览器中输入 redirect.com/path-to-some-url 它实际上做的是去 base.com/path-to-some-url - 当然有无限的 url 路径。

有人可以帮忙吗? 我更喜欢纯 php 文件代码,我只是将 base.com 放在其中,其余部分发生在每个 url 入口处。

【问题讨论】:

    标签: php regex redirect


    【解决方案1】:

    这应该可以。把它放在redirect.com 的index.php 文件中:

    <?php
    header('Location: http://base.com/q='.$_GET["q"]); 
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-16
      • 2016-02-29
      • 2016-08-12
      • 1970-01-01
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多