阿帕奇:重定向域与追加查询字符串其他域 [英] Apache: Redirect domain to other domain with appended querystring

查看:178
本文介绍了阿帕奇:重定向域与追加查询字符串其他域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要example.se重定向到example.com?lang=swe~~V

I want example.se to redirect to example.com?lang=swe

它正常工作与此Apache配置:

It works fine with this apache config:

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

问题是,这打破如果有域,除权后别的东西:example.se/page1应该重定向到example.com/page1?lang=1~~V但与上面设置重定向到example.com?lang~~V = swepage1。

The problem is that this breaks if there is something else after the domain, ex: example.se/page1 should redirect to example.com/page1?lang=1 but with the setup above it redirects to example.com?lang=swepage1.

有没有办法做到这一点吧?

Is there a way to do this right?

推荐答案

我相信它应该是这样一些接近:

I believe it should be something close to this:

RedirectMatch永久^ /(+)$ http://example.com/ $ 1吗?LANG = SWE

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

这篇关于阿帕奇:重定向域与追加查询字符串其他域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆