【问题标题】:Apache: Redirect domain to other domain with appended querystringApache:使用附加查询字符串将域重定向到另一个域
【发布时间】:2011-03-18 17:25:16
【问题描述】:

我希望 example.se 重定向到 example.com?lang=swe

这个 apache 配置可以正常工作:

<VirtualHost *:80>
    ServerName example.se
    ServerAlias *.example.se
    Redirect permanent / http://example.com/?lang=swe
</VirtualHost>

问题是,如果域之后还有其他内容,这会中断,例如:example.se/page1 应该重定向到 example.com/page1?lang=1 但使用上面的设置它会重定向到 example.com?lang =swepage1。

有没有办法做到这一点?

【问题讨论】:

    标签: apache redirect apache-config


    【解决方案1】:

    我认为应该是这样的:

    RedirectMatch 永久 ^/(.+)$ http://example.com/$1?lang=swe

    【讨论】:

    • 完美!使用 (.*) 代替,但仍然仅适用于域 example.se
    猜你喜欢
    • 2020-05-29
    • 1970-01-01
    • 2011-09-18
    • 2019-02-10
    • 1970-01-01
    • 1970-01-01
    • 2010-11-14
    • 1970-01-01
    • 2014-12-03
    相关资源
    最近更新 更多