Apache: Redirect domain to other domain with appended querystring

眉间皱痕 提交于 2020-01-07 05:00:37

问题


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

It works fine with this apache config:

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

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?


回答1:


I believe it should be something close to this:

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



来源:https://stackoverflow.com/questions/5355655/apache-redirect-domain-to-other-domain-with-appended-querystring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!